{"id":19242638,"url":"https://github.com/theedgeofrage/logfmt","last_synced_at":"2025-09-26T15:49:43.444Z","repository":{"id":223954535,"uuid":"762009335","full_name":"TheEdgeOfRage/logfmt","owner":"TheEdgeOfRage","description":"Simple logfmt CLI tool for colorizing, analyzing, filtering, and formatting structured logs","archived":false,"fork":false,"pushed_at":"2025-08-27T15:50:55.000Z","size":34,"stargazers_count":17,"open_issues_count":2,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-24T10:47:25.784Z","etag":null,"topics":["cli","golang","logfmt"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheEdgeOfRage.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,"zenodo":null}},"created_at":"2024-02-22T22:48:14.000Z","updated_at":"2025-08-27T18:59:31.000Z","dependencies_parsed_at":"2024-06-21T12:56:35.563Z","dependency_job_id":"86bee23f-a849-457b-8255-402c7ab562d0","html_url":"https://github.com/TheEdgeOfRage/logfmt","commit_stats":null,"previous_names":["theedgeofrage/logfmt"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/TheEdgeOfRage/logfmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEdgeOfRage%2Flogfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEdgeOfRage%2Flogfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEdgeOfRage%2Flogfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEdgeOfRage%2Flogfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheEdgeOfRage","download_url":"https://codeload.github.com/TheEdgeOfRage/logfmt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheEdgeOfRage%2Flogfmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277103473,"owners_count":25761397,"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-09-26T02:00:09.010Z","response_time":78,"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":["cli","golang","logfmt"],"created_at":"2024-11-09T17:14:57.643Z","updated_at":"2025-09-26T15:49:43.439Z","avatar_url":"https://github.com/TheEdgeOfRage.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logfmt CLI\n\nThis is a (very) simple CLI tool to make reading and parsing logfmt logs from your terminal easier.\nIt supports colorized output, output field selection, and log level and key value filtering.\n\n## What is logfmt?\n\n[logfmt](https://www.brandur.org/logfmt) is a basic structured logging format that uses key=value pairs. It is\nmost popular in go apps, due to its simplicity, and ease of reading and parsing. However, printing logfmt\nformatted logs to the terminal and trying to find what you are looking for can be difficult, especially when there's a\nlot of debug keys like `source`, `function`, `caller`, etc. The fact that its all white on black (or black on white if\nyou hate your retinas) doesn't help either.\n\n### The solution\n\nThe goal of this tool is to make these logs more readable by applying some syntax highlighting, separating the\n`timestamp` and `level` fields into static locations without their keys, filtering based on log level, picking specific\noutput columns, and filtering based on specific key=value pairs (say you're looking only for a specific API call).\n\n![logfmt example](https://pyazo.com/3fd63738-3d4f-45d8-b749-f3cfb8b32cee.png)\n\n## How to\n\n### Installation\n\nI recommend adding a `GOBIN` env var to your shell with a location to where you want go compiled programs to reside\nand adding that location to your `PATH`. With that set up, you can install logfmt using:\n\n```\ngo install github.com/TheEdgeOfRage/logfmt@latest\n```\n\n### Usage\n\n```\nUsage:\n  logfmt [OPTIONS]\n\nApplication Options:\n  -l, --level=       Log level filter. One of TRACE, DEBUG, INFO, WARN, ERROR, FATAL (default: INFO)\n  -o, --output=      Output field selector (comma separated)\n  -e, --exclude=     Exclude field selector (comma separated)\n  -f, --filter=      Filter fields (key=value comma separated)\n  -n, --no-color     Disable color output\n  -c, --force-color  Force color output, even when outputting to a pipe\n  -t, --no-time      Disable time output\n  -k, --keep-empty   Keep lines with no field present selected by output or with all excluded\n  -r, --raw          Output only selected fields values (comma separated) lcut like\n  -A, --all          Output all field after the output fields effectivly making it ordered\n\nHelp Options:\n  -h, --help         Show this help message\n```\n\nIf installed in your PATH, you can just run the `logfmt` program without any arguments and it will start reading log\nlines from stdin and write the formatted lines to stdout.\n\nThis CLI follows the UNIX philosophy, so it will only read from stdin and write to stdout. If you want stderr or a different\nfile, use your shell's built-in directives for that.\n\nA typical usecase would be running a service for local development, or fetching the logs from a Kubernetes pod:\n\n```\ngo run yourservice.go | logfmt\nkubectl logs -n namespace pod | logfmt\n```\n\n#### Level filtering\n\nTo filters your logs based on the log level, you can pass the `-l` flag with a log level in CAPS format. The level you\nprovide is lowest level that will get printed, so if you set it to `WARN`, only `WARN`, `ERROR`, and `FATAL` logs will\nshow up.\n\n#### Output field selection\n\nYou can pass in a comma separated list of fields to the `-o` flag that you want it to print to the output. The timestamp\nand level are always printed, so this only applies to additional fields.\n\n#### Excluding fields\n\nIf you want to exclude some fields from the output, you can pass in a comma separated list of fields to the `-e` flag.\nThis can be useful in cases where you don't know what fields are going to be present in the logs, but want to exclude\nsome verbose ones.\n\n#### Filtering by values\n\nIf you want to only select records that have a specific value on a key, you can pass one or more comma separated filters\nto the `-f` flag in the `key=value` format. Only log lines that match all the filters exactly will be printed. Regex or\nnumerical filtering might come in the future.\n\n#### No color\n\nIf you don't want to have colors on the output, set `-n`.\n\n#### Force color\n\nBy default, logfmt will detect if the output is a pipe or redirect to a file and will automatically disable colors. If\nyou still want to have colorized output, for example when piping into `less`, you can force it using `-c`.\n\n### Show empty lines \n\nBy default, `logfmt` doesn't output lines when no fields are selected. To **change that behavior** and **show empty lines**, pass the `-k` flag.\n\n### Raw output\n\nDon't output keys just values (emulate lcut like behavior), also outputs timestamp and level keys by default. With -o singleField allow getting one field\n\n### Output All\n\nOutput all keys if flag is set and treat output option as an order which fields should be displayed first\n\n### Sponsors\n\n[\u003cimg src=\"https://api.gitsponsors.com/api/badge/img?id=762009335\" height=\"20\"\u003e](https://api.gitsponsors.com/api/badge/link?p=TiQmn6g+rUCXsoHQ8LFH5o8rqe9cxSSV1UZnSww4OkaDaJwHRhmTbYpBG0WBftpmMe5A5Aif6rgCVUEeEfnxWpK5ULZXvtMffXQpi9I2mYk6IbcR6o6oZiIYa/QEVs8yS1LL/QbJNNCpjnSXNbKSV5+dDMAZHmI5DRTAclaG4NI=)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheedgeofrage%2Flogfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheedgeofrage%2Flogfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheedgeofrage%2Flogfmt/lists"}