Filter Rules
Exclude requests from Subtrace logs using simple filters
Subtrace tracks all requests by default, but you can exclude certain requests with a simple YAML-based config file. Here’s an example:
To use a config file, set the --config
command line flag when starting
Subtrace:
You can also pass this as an environment variable:
At request time, Subtrace will evaluate all rules in order until a matching
rule is found. Using the first matching rule’s then
field, Subtrace decides
whether the request should be included or excluded. If no matching rule is
found, the request is included by default.
Syntax
The if
condition is written using CEL, a simple language
with a syntax similar to JavaScript. Here’s a list of commonly used syntax as
reference examples:
request.method == "POST"
request.url != "/robots.txt"
request.url.contains("dashboard")
request.url.startsWith("/api/")
request.url.endsWith(".jpg") || request.url.endsWith(".png")
response.status >= 400 && response.status <= 499
You can find the complete CEL language definition here.