Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/tui/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func (m *DashboardModel) renderLogScrollContent(height int, logWidth int) []stri
instructions = append(instructions, []string{
"📋 Key commands:",
" • ?/h: Show help",
" • /: Filter logs (regex)",
" • /: Filter logs (message & attributes)",
" • Ctrl+f: Filter logs by severity",
" • s: Search and highlight",
" • Tab: Navigate sections",
Expand Down
4 changes: 2 additions & 2 deletions internal/tui/modal_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ SECTIONS:
Logs - Navigate and inspect individual log entries

FILTER & SEARCH:
Filter (/): Type regex patterns to filter displayed logs
Filter (/): Type regex patterns to filter logs (searches message & attributes)
Search (s): Type text to highlight in displayed logs
Severity (Ctrl+f): Filter by log severity levels
Examples: "error", "k8s.*pod", "severity.*INFO"
Examples: "error", "k8s.*pod", "service.name", "host.name.*prod"

AI ANALYSIS:
Set environment variables for AI-powered log analysis:
Expand Down
2 changes: 1 addition & 1 deletion internal/tui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func initializeDrain3BySeverity() map[string]*Drain3Manager {
// NewDashboardModel creates a new dashboard model with stop words
func NewDashboardModel(maxLogBuffer int, updateInterval time.Duration, aiModel string, stopWords map[string]bool, reverseScrollWheel bool) *DashboardModel {
filterInput := textinput.New()
filterInput.Placeholder = "Filter logs (regex supported)..."
filterInput.Placeholder = "Filter logs by message or attributes (regex supported)..."
filterInput.CharLimit = 200

searchInput := textinput.New()
Expand Down
36 changes: 34 additions & 2 deletions internal/tui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ func (m *DashboardModel) updateFilteredView() {

// Apply filter to all entries
for _, entry := range m.allLogEntries {
// Check regex filter (if any)
passesRegexFilter := m.filterRegex == nil || m.filterRegex.MatchString(entry.RawLine)
// Check regex filter (if any) - search in message, attributes keys, and attribute values
passesRegexFilter := m.filterRegex == nil || m.matchesFilter(entry)

// Check severity filter (if active)
// Normalize severity to match filter keys
Expand Down Expand Up @@ -783,6 +783,38 @@ func (m *DashboardModel) updateProcessingRateStats() {
}
}

// matchesFilter checks if a log entry matches the current regex filter
// It searches in the message, attribute keys, and attribute values
func (m *DashboardModel) matchesFilter(entry LogEntry) bool {
if m.filterRegex == nil {
return true
}

// Check the raw log line (message)
if m.filterRegex.MatchString(entry.RawLine) {
return true
}

// Check the processed message
if m.filterRegex.MatchString(entry.Message) {
return true
}

// Check all attribute keys and values
for key, value := range entry.Attributes {
// Check if the attribute key matches
if m.filterRegex.MatchString(key) {
return true
}
// Check if the attribute value matches
if m.filterRegex.MatchString(value) {
return true
}
}

return false
}

// updateHeatmapData updates the minute-by-minute heatmap data for the counts modal
func (m *DashboardModel) updateHeatmapData(entry LogEntry) {
// Now entry.Timestamp is always the receive time, so we can use it directly
Expand Down
Loading