Skip to content

feat: Add CloudWatch Logs browser with live tail (M3.7)#72

Merged
nathanhuh merged 7 commits intomainfrom
feat/cloudwatch-logs
Apr 6, 2026
Merged

feat: Add CloudWatch Logs browser with live tail (M3.7)#72
nathanhuh merged 7 commits intomainfrom
feat/cloudwatch-logs

Conversation

@nathanhuh
Copy link
Copy Markdown
Contributor

Summary

Add CloudWatch Logs browsing with live tail and search capabilities, completing PLAN.md milestone M3.7.

3 new screens:

  • Log Group List — filterable list showing name, retention policy, stored bytes
  • Log Stream List — filterable, sorted by last event time descending
  • Log Viewer — scrollable log events with:
    • Time range presets: 1-6 keys (5m / 15m / 1h / 6h / 24h / 7d)
    • Live tail: t key toggles 2-second polling with auto-scroll
    • Filter pattern: f key for CloudWatch Insights filter syntax
    • Load more: n key for pagination (older events)
    • Log level color coding: ERROR (red), WARN (yellow), INFO (green), DEBUG (dim)

Service layer:

  • ListLogGroups — paginated via DescribeLogGroups
  • ListLogStreams — paginated, ordered by LastEventTime
  • FilterLogEvents — with time range, filter pattern, and pagination token

Related Issues

Closes #29

Validation

  • make test — 15 new tests + all existing tests pass
  • make build — compiles cleanly
  • README updated with features table and key bindings

- Add Log Group list with filterable name/retention/size columns
- Add Log Stream list sorted by last event time
- Add Log Viewer with scrollable events and log level color coding
  (ERROR=red, WARN=yellow, INFO=green, DEBUG=dim)
- Live tail: toggle with 't' key, polls every 2s, auto-scrolls
- Time range presets: 1-6 keys for 5m/15m/1h/6h/24h/7d
- Filter pattern input with 'f' key (CloudWatch Insights syntax)
- Pagination: 'n' key to load older events
- Add CloudWatchLogsClientAPI interface with DescribeLogGroups,
  DescribeLogStreams, FilterLogEvents
- 15 tests covering service operations, models, and helpers
- Update README features table and key bindings

Closes #29
amazon-q-developer[bot]

This comment was marked as resolved.

- Validate cwLogTimeRange before accessing cwTimeRanges array
- Fall back to index 2 (1h) if out of bounds
- Prevents potential runtime panic on invalid time range index
@nathanhuh

This comment was marked as duplicate.

amazon-q-developer[bot]

This comment was marked as resolved.

@nathanhuh

This comment was marked as duplicate.

amazon-q-developer[bot]

This comment was marked as resolved.

@nathanhuh

This comment was marked as duplicate.

amazon-q-developer[bot]

This comment was marked as resolved.

@nathanhuh

This comment was marked as duplicate.

amazon-q-developer[bot]

This comment was marked as resolved.

@nathanhuh

This comment was marked as duplicate.

amazon-q-developer[bot]

This comment was marked as resolved.

@nathanhuh
Copy link
Copy Markdown
Contributor Author

/q review

Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR successfully implements CloudWatch Logs browsing with live tail functionality (M3.7). The implementation follows established patterns in the codebase and is well-tested with 15 new tests covering all major code paths.

Implementation Quality:

  • Clean separation of concerns with dedicated screen handlers, service layer, and models
  • Comprehensive error handling throughout the AWS API calls
  • Proper pagination support for log groups, streams, and events
  • Well-designed deduplication logic for live tail to prevent duplicate events
  • Good test coverage with both success and error cases

Key Features Delivered:

  • ✅ Log group list with retention and storage information
  • ✅ Log stream list sorted by last event time
  • ✅ Log viewer with time range presets (5m to 7d)
  • ✅ Live tail with 2-second polling and auto-scroll
  • ✅ CloudWatch Insights filter pattern support
  • ✅ Pagination for loading older events
  • ✅ Color-coded log levels (ERROR/WARN/INFO/DEBUG)

The code is production-ready and the tests validate correct behavior. Great work implementing this feature!


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

if err != nil {
return errMsg{err: err}
}
m.awsRepo = repo
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Logic Error: The function loadCWLogGroups modifies the Model's awsRepo field inside the returned command closure. This is not safe in the Bubble Tea architecture where commands are executed asynchronously. The assignment m.awsRepo = repo on line 538 operates on a copy of Model m that is discarded after the closure returns. The main Model never receives this updated awsRepo, so subsequent calls to loadCWLogStreams and loadCWLogEvents will find m.awsRepo == nil and needlessly recreate the repository each time.

Suggested change
m.awsRepo = repo
// Note: Cannot assign m.awsRepo here - m is a copy in this closure
// The repository will be recreated as needed in subsequent calls

Copy link
Copy Markdown
Contributor

@YoungJinJung YoungJinJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nathanhuh nathanhuh merged commit 4a87424 into main Apr 6, 2026
2 checks passed
@nathanhuh nathanhuh deleted the feat/cloudwatch-logs branch April 6, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add CloudWatch Logs browser (M3.7)

2 participants