{"id":16851895,"url":"https://github.com/cad97/tracing-filter","last_synced_at":"2025-04-11T06:56:20.538Z","repository":{"id":39660060,"uuid":"471140144","full_name":"CAD97/tracing-filter","owner":"CAD97","description":"A replacement for tracing_subscriber EnvFilter","archived":false,"fork":false,"pushed_at":"2023-02-28T12:01:59.000Z","size":2945,"stargazers_count":9,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"v0.1","last_synced_at":"2025-03-25T04:51:20.335Z","etag":null,"topics":["filter","logging","tracing"],"latest_commit_sha":null,"homepage":"https://cad97.github.io/tracing-filter/v0.1/tracing_filter/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CAD97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-17T20:56:46.000Z","updated_at":"2023-06-19T09:11:54.000Z","dependencies_parsed_at":"2025-02-18T23:41:26.069Z","dependency_job_id":null,"html_url":"https://github.com/CAD97/tracing-filter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Ftracing-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Ftracing-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Ftracing-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAD97%2Ftracing-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CAD97","download_url":"https://codeload.github.com/CAD97/tracing-filter/tar.gz/refs/heads/v0.1","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248358555,"owners_count":21090402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filter","logging","tracing"],"created_at":"2024-10-13T13:34:01.181Z","updated_at":"2025-04-11T06:56:20.512Z","avatar_url":"https://github.com/CAD97.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tracing-filter\n\nA system for filtering/querying structured tracing records.\n\nVery much in-progress. **Things are in various states of (non)functional**.\n\nCurrently only targets filtering events as they are collected. However, I would\n*like* to support filtering recorded events as well.\n\n## Filters\n\nWhen you construct a `Filter` type, you determine which kind of filters it\nsupports. You cannot mix different kinds of filters in one filtering layer.\n\nNote that a complicated filter can slow down your tracing performance, so\nusing a filter from an untrusted (i.e. user) source is typically not\nrecommended. This is particularly important for legacy and query filters,\nhowever; because they use [regex-automata](https://lib.rs/crates/regex-automata)\nto implement unbuffered regex filtering, they are vulnerable to unbounded regex\ncompilation time à la [CVE-20222-24713]. Simple filters do not do unbuffered\nregex evaluation, so instead use the regex crate directly, which has mitigated\nthis issue.\n\n[CVE-20222-24713]: https://github.com/rust-lang/regex/security/advisories/GHSA-m5pq-gvj9-9vr8\n\n### Simple filters\n\ntracing-filter is 99.999% compatible with [env_logger](lib.rs/env_logger)'s\nfilter syntax. As such, you can write simple filters the way you always have:\n\n- `warn` — filter to only events of level `WARN` or `ERROR`\n- `my_app=debug` — filter to `DEBUG` or higher events only from `my_app`\n- `warn,my_app::module=trace` — get warning events and trace `my_app::module`\n- `off` — disable all logging\n- `debug/foo` — filter to `DEBUG` or higher events whose message contains \"`foo`\"\n\nIn general, the syntax is `target=level/regex`. An event is included if its\ntarget *starts with* the listed `target`, its level passes the `level` filter,\nand its message matches `regex`. With the env_logger crate, the regex string\nis a simple substring match if you don't enable the `regex` feature; with our\nsimple filters,\n\n**This should be 99%\u003csup\u003e†\u003c/sup\u003e functional in the `tracing_filter::simple` module.**\n\n\u003csup\u003e†\u003c/sup\u003e: tracing does not allow filtering on events' fields' contents\n[yet](https://github.com/tokio-rs/tracing/pull/2008). tracing-filter chooses to\njust siliently ignore the regex filter for the time being (but it does validate\nthe filter).\n\n### Legacy filters\n\nThe filter syntax supported by tracing-subscriber@0.3's `EnvFilter`, complete\nwith all of its p̛̭a͖͕ŕ̯̪̥͈̠̙̣s͙̪̮̟͠i̥̞̠n͍̙̭͡g̸̜̤̦̤̳͍ ͓͜ẉ̨̳̠̗̗i̱t͚̹͉̯h̢̩̤̹͙̩͙ ̪̻͈r̻̙̥̭̯̫e̮̭̞̣̮͕̪g҉̦͚̬̖e͇̕x̛͖̣̮̞̜ͅ \"peculiarites\"; 100% bug-for-bug compatible.\n\nAs such, you can use all of the filters that you have been using:\n\n- `warn` — filter to only events of level `WARN` or `ERROR`\n- `my_app=debug` — filter to `DEBUG` or higher events only from `my_app`\n- `warn,my_app::module=trace` — get warning events and trace `my_app::module`\n- `off` — disable all logging\n- `[span]=debug` — filter to `DEBUG` or higher events inside a span named `span`\n- `[{field}]` — filter to events with a field `field` or within a span with name `field`\n- `[{key=val}]` — filter to events within a span with field `key` that matches the regex `val`\n- `[{key=0}]` — filter to events within a span with field `key` that recorded a number that equals `0`\n- `[{key=true}]` — filter to events within a span with field `key` that recorded a boolean value of `true`\n- `target[span]` — filter to events within a span with target `target` and name `span`\n\nIn general, the syntax is `target[span{field=value}]=level`.\n\n**This should be 100% functional in the `tracing_filter::legacy` module.**\n\n### Query filters\n\nQuery filters are tracing-filter's way of selecting events and taking advantage\nof tracing's structured events. Query filters are a 99% superset of simple\nfilters; specifically, for each `,` separated directive, it's treated as a query\nfilter if and only if it starts with `(`; otherwise it is treated as a simple\nfilter.\n\n**This is still undergoing design work.**\n\n## Why not use tracing-filter?\n\n- tracing-filter is highly experimental\n- tracing-filter is not officially supported by the tracing team\n- tracing-filter is not published to crates-io\n- tracing-filter works with the unpublished tracing 0.2.0 ecosystem\n\n## Why use tracing-filter?\n\n- More configurable than tracing-subscriber@0.3's `EnvFilter`\n- You want your runtime filter syntax to work for serialized event queries\n- You like the author and want them to feel proud of themself\n- We have nice [miette](https://lib.rs/miette)-powered errors :smile:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcad97%2Ftracing-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcad97%2Ftracing-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcad97%2Ftracing-filter/lists"}