Skip to content

Fix tilt logs -f to respect resource filtering#6735

Open
krishnactive wants to merge 1 commit intotilt-dev:masterfrom
krishnactive:fix/logs-resource-filtering-6663
Open

Fix tilt logs -f to respect resource filtering#6735
krishnactive wants to merge 1 commit intotilt-dev:masterfrom
krishnactive:fix/logs-resource-filtering-6663

Conversation

@krishnactive
Copy link
Copy Markdown

Problem

When running tilt logs -f <resource>, build event logs from other resources were incorrectly shown in the output. This included:

  • Initial Build messages from all resources
  • Files Changed messages from unrelated services

Root Cause

In internal/hud/client/log_filter.go, the LogFilter.Matches() function was checking if a log line is a BuildEvent BEFORE checking if it matches the resource filter. This caused all build event logs to bypass the resource filtering.

Solution

Reorder the filter checks in LogFilter.Matches() to apply the resource filter FIRST, before checking for build events. This ensures all logs, including build events, respect the resource filter.

Changes

  • File: internal/hud/client/log_filter.go (lines 111-121)
  • Moved resource filter check BEFORE BuildEvent check
  • Minimal change: 6 lines added, 5 removed

Testing

The fix has been:

  • ✅ Verified to compile successfully (v0.37.0-dev)
  • ✅ Tested with the binary
  • ✅ Code reviewed for logic correctness

Fixes #6663

When running 'tilt logs -f <resource>', build event logs from other
resources were incorrectly shown in the output. The resource filter
check was happening after the build event check, allowing build logs
to bypass resource filtering.

Solution: Reorder the filter checks in LogFilter.Matches() to apply
the resource filter first, before checking for build events. This
ensures all logs, including build events, respect the resource filter.

Fixes tilt-dev#6663
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.

Resource-specific log streaming includes unrelated events

1 participant