Skip to content

Add filter to CloudWatch Logs tail view#121

Merged
yimsk merged 5 commits intodevelopfrom
feature/120-log-tail-filter
Jan 7, 2026
Merged

Add filter to CloudWatch Logs tail view#121
yimsk merged 5 commits intodevelopfrom
feature/120-log-tail-filter

Conversation

@yimsk
Copy link
Copy Markdown
Contributor

@yimsk yimsk commented Jan 7, 2026

Summary

  • Client-side substring filter for CloudWatch Logs tail
  • "/" key to activate, real-time filtering
  • Shows filtered/total count

Changes

  • Add textinput.Model for filter input
  • Implement matchesFilter() for substring matching
  • Update ViewString() to show filter UI/status
  • Add HasActiveInput() interface method

Testing

  • ✅ All tests pass
  • ✅ Consistent with codebase patterns

Closes #120

🤖 Generated with Claude Code

yimsk and others added 4 commits January 7, 2026 14:30
Implements hybrid filter system with AWS and client modes:
- AWS mode: Uses CloudWatch filterPattern API (cost efficient)
- Client mode: Local substring match (instant UX)

Key features:
- / key activates filter input (consistent with ResourceBrowser)
- Client mode: real-time filtering as user types
- AWS mode: applies filter on Enter (triggers API re-fetch)
- Ctrl+F toggles between modes
- c key clears filter (or buffer if no filter)
- Visual indicators: 🔍 filter display, mode label [AWS]/[Client]
- Filtered count display: (45/1,234 lines)

Implementation:
- Single file change: internal/view/log_view.go
- Pure additive feature, no breaking changes
- Follows existing patterns (textinput, ViewportState)

Closes #120

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add HasActiveInput() method to LogView so app.go correctly
handles input mode and doesn't treat Backspace as back navigation.

Fixes issue where editing filter text with Backspace caused
screen to go back instead of deleting characters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove AWS mode complexity. Client-side substring match is sufficient
for tail use case where logs are already fetched.

Removed:
- filterPattern (AWS server-side filtering)
- filterMode toggle
- Ctrl+F mode switching
- Mode display [AWS]/[Client]
- API FilterPattern parameter

Simplified:
- Single filterText field (client-side substring)
- / to activate filter
- Real-time filtering as user types
- Enter to done (no-op, already filtered)
- c to clear
- Cleaner UI without mode indicators

Rationale: Tail views logs already fetched. AWS filtering only useful
for high-volume streams (rare case). Hybrid approach added unnecessary
complexity and confusion (which filter is active?).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Eliminate duplication by extracting filter matching logic into
dedicated matchesFilter() method, reused in updateViewportContent()
and getDisplayedCount().

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@claude

This comment was marked as resolved.

Addresses PR review feedback:
- Track width/height to recalc viewport when filter cleared
- Add min width check (10 chars) for narrow terminals
- Truncate long filter text in status line (>20 chars)
- Add comprehensive test coverage (7 new tests)
- Keep real-time filtering (1000 logs = negligible perf impact)

Tests added:
- TestLogViewFilterActivation
- TestLogViewFilterMatching
- TestLogViewFilterClear
- TestLogViewFilteredCount
- TestLogViewHasActiveInput
- TestLogViewFilterSetSizeRecalculation
- TestLogViewFilterStatusLine

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@yimsk yimsk merged commit 0e3e108 into develop Jan 7, 2026
5 checks passed
@yimsk yimsk deleted the feature/120-log-tail-filter branch January 7, 2026 15:26
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.

1 participant