{"id":30219797,"url":"https://github.com/dorthu/lf","last_synced_at":"2025-10-14T07:38:00.678Z","repository":{"id":236209619,"uuid":"792143640","full_name":"Dorthu/lf","owner":"Dorthu","description":"logfmt filterer and formatter inspired by jq","archived":false,"fork":false,"pushed_at":"2024-05-24T02:14:46.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-14T09:07:07.803Z","etag":null,"topics":["logfmt","logfmt-parser","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dorthu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-26T04:14:28.000Z","updated_at":"2024-05-24T02:12:08.000Z","dependencies_parsed_at":"2024-06-19T11:05:00.203Z","dependency_job_id":"e96a6dd2-9c68-40d6-93b8-faa1f8aee226","html_url":"https://github.com/Dorthu/lf","commit_stats":null,"previous_names":["dorthu/lf"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Dorthu/lf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dorthu%2Flf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dorthu%2Flf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dorthu%2Flf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dorthu%2Flf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dorthu","download_url":"https://codeload.github.com/Dorthu/lf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dorthu%2Flf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018219,"owners_count":26086307,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["logfmt","logfmt-parser","logging"],"created_at":"2025-08-14T08:53:52.294Z","updated_at":"2025-10-14T07:38:00.670Z","avatar_url":"https://github.com/Dorthu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lf\n\nlogfmt parser and filterer inspired by [`jq`](https://jqlang.github.io/jq/)\n\n## Usage\n\nSuppose your application outputs logs like this:\n\n```\ntime=\"2024-04-26 20:56:00\" msg=\"example message\" tag=example\n```\n\nTo get an easier-to-read format, you might pipe the log to `lf` like so:\n\n```\ntail -f /var/log/file | lf [.time] .msg\n```\n\nIf you only wanted records with the tag \"example2\", you might do this:\n\n```\ntail -f /var/log/file | lf tag=example2\n```\n\nAnd to give output only matching lines in an easier format, you might say:\n\n```\ntail -f /var/log/file | lf 'tag=example | [.time] .msg'\n```\n\n`lf` provides two features: **Filtering** and **Formatting**\n\n### Filtering\n\nFilters are given as key/value pairs like normal logfmt, except that the `=` may be\none of four allowed operators:\n\n| Operator | Meaning |\n| --- | --- |\n| `=` | Value must match exactly |\n| `!=` | Value must not match exactly |\n| `~` | Value must be present in record |\n| `!~` | Value must not be present in record |\n| `+` | The key must be present.  Takes no argument |\n| `-` | The key must be absent.  Takes no argument |\n\nFor example, for this input record:\n\n```\nid=12345 msg=\"it worked\"\n```\n\nThe following filters match:\n\n```\nid=12345\nid!=4567\nid+\nmsg~worked\nmsg!~failed\nabsent-\n```\n\nThe key must always be present to a match to occur unless matching on key\nabsence; none of the following filters match the above record:\n\n```\ntag=test\ntag!=test\ntag~test\ntag!~test\n```\n\n### Formatting\n\nFormat strings are templates that replace the placeholder values, which must start with\na `.`, be valid logfmt keys, and must follow a character that could not be part of a valid\nlogfmt key, with the values of the like-named key.\n\nFor instance, for the following record:\n\n```\nid=12345 msg=\"it worked\"\n```\n\nThe following format strings would produce the given output:\n\n| format | output |\n| --- | --- |\n| `.id` | 12345 |\n| `[.id] .msg` | [12345] it worked |\n| `.id.msg` | 12345.msg |\n| `.tag (.id): .msg |  (12345): it worked |\n\n\n### Which Is Provided?\n\nWhen `lf` receives args that include a `|`, that character is expected to divide\nfilters from formats; the output format is to the right of the last `|`, and all else\nis a filter (additional `|` characters are redundant).\n\nIf `lf` receives no `|` in its args, it uses hueristics to decide if it was given a\nfilter or a format.  When in doubt, the args are assumed to be a format.\n\nTo disambiguate, include a `|` character - filters/formats are not otherwise required.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorthu%2Flf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdorthu%2Flf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorthu%2Flf/lists"}