{"id":14008077,"url":"https://github.com/life4/logit","last_synced_at":"2026-02-13T06:21:55.740Z","repository":{"id":57573340,"uuid":"325575906","full_name":"life4/logit","owner":"life4","description":"🪵 CLI tool to handle JSON logs","archived":false,"fork":false,"pushed_at":"2021-01-20T11:19:54.000Z","size":2045,"stargazers_count":26,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-10T11:02:32.608Z","etag":null,"topics":["cli","golang","json","logger","logging","sentry"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/life4.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}},"created_at":"2020-12-30T14:49:56.000Z","updated_at":"2024-06-12T20:20:47.000Z","dependencies_parsed_at":"2022-09-26T19:01:15.689Z","dependency_job_id":null,"html_url":"https://github.com/life4/logit","commit_stats":null,"previous_names":["orsinium-labs/logit"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Flogit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Flogit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Flogit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Flogit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/life4","download_url":"https://codeload.github.com/life4/logit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227410434,"owners_count":17774746,"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":["cli","golang","json","logger","logging","sentry"],"created_at":"2024-08-10T11:01:12.575Z","updated_at":"2026-02-13T06:21:50.694Z","avatar_url":"https://github.com/life4.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# logit\n\n**logit** is a CLI tool that consumes logs in JSON and feeds them into a logs storage like file, Amazon CloudWatch, or Slack.\n\nWhy it is important:\n\n* Your application will contain only bussiness logic. Don't write your own logging library.\n* Your application will not send secondary network requests.\n* Your application will be faster. It's easy to make a JSON entry and feed it into stdout, and logit will take care of the rest.\n* Your application will be more environment-agnostic. Here you run it on your machine, production runs on AWS, tomorrow you migrate on GCP. And in all cases, only the logit config is different, application is the same.\n\nSupported handlers:\n\n* console and files:\n  * `json`\n  * `logfmt`\n  * `rolling`\n  * `text`\n  * `zalgo`\n* databases:\n  * `elastic`\n  * `influxdb`\n  * `mongodb`\n  * `redis`\n* messengers:\n  * `discord`\n  * `slack`\n* log collectors:\n  * `aws`\n  * `fluentd`\n  * `gcloud`\n  * `graylog`\n  * `sentry`\n  * `syslog`\n  * `loggly`\n  * `logstash`\n\n## Installation\n\nThe project is \"go gettable\":\n\n```bash\ngo get github.com/life4/logit\n```\n\nThe best practice for your production is to build a minimal binary with only handlers you need:\n\n```bash\ngit clone https://github.com/life4/logit.git\ncd logit\ngo build -tags 'h_clean,h_aws,h_gcloud' -o logit.bin .\n```\n\nHandlers `json`, `logfmt`, and `text` are always included. All other can be disabled by `h_clean` build tag and then individually enabled with `h_{HANDLER}` build tags.\n\n## Usage\n\nFirst of all, you need a config. Let's make the following `logit.toml`:\n\n```toml\n[[handler]]\nformat = \"text\"\n```\n\nAnd now, pipe some JSON into stdin of logit:\n\n```bash\n$ export text='{\"animal\":\"walrus\",\"level\":\"fatal\",\"msg\":\"A huge walrus appears\",\"time\":\"2020-12-29 15:09:21\"}'\n$ echo $text | logit\nFATAL  [2020-12-29 15:09:21] A huge walrus appears    animal=walrus\n```\n\nOr just a plain text, why not:\n\n```bash\n$ echo 'hi' | logit\nINFO   [2021-01-04 14:48:50] hi\n```\n\nEasy!\n\nSee [documentation](./docs/config.md) for more details.\n\n## Producing JSON\n\nThere are some good libraries that you can use in your application to produce JSON logs:\n\n* Go:\n  * [onelog](https://github.com/francoispqt/onelog): fastest.\n  * [logrus](github.com/sirupsen/logrus): most popular.\n* Node.js:\n  * [bunyan](https://github.com/trentm/node-bunyan)\n* Python:\n  * [structlog](https://github.com/hynek/structlog): powerful.\n  * [python-json-logger](https://github.com/madzak/python-json-logger): formatter for the default [logging](https://docs.python.org/3/library/logging.html).\n* Rust:\n  * [slog-json](https://github.com/slog-rs/json) for [slog-rs](https://github.com/slog-rs/slog).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flife4%2Flogit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flife4%2Flogit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flife4%2Flogit/lists"}