{"id":22292122,"url":"https://github.com/joaodrp/gelf-pretty","last_synced_at":"2025-07-28T23:33:10.443Z","repository":{"id":57584368,"uuid":"178553079","full_name":"joaodrp/gelf-pretty","owner":"joaodrp","description":"CLI to pretty-print GELF log lines","archived":false,"fork":false,"pushed_at":"2023-02-25T02:49:34.000Z","size":52,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T05:03:19.844Z","etag":null,"topics":["cli","gelf","graylog","log","logging","pretty-print"],"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/joaodrp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-03-30T12:01:10.000Z","updated_at":"2023-03-07T16:30:01.000Z","dependencies_parsed_at":"2024-06-20T17:20:58.003Z","dependency_job_id":"6338d079-578e-4c85-9531-96809b019edd","html_url":"https://github.com/joaodrp/gelf-pretty","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/joaodrp/gelf-pretty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaodrp%2Fgelf-pretty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaodrp%2Fgelf-pretty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaodrp%2Fgelf-pretty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaodrp%2Fgelf-pretty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joaodrp","download_url":"https://codeload.github.com/joaodrp/gelf-pretty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaodrp%2Fgelf-pretty/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267604310,"owners_count":24114521,"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-07-28T02:00:09.689Z","response_time":68,"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","gelf","graylog","log","logging","pretty-print"],"created_at":"2024-12-03T17:19:50.967Z","updated_at":"2025-07-28T23:33:10.158Z","avatar_url":"https://github.com/joaodrp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\" style=\"border-bottom: none;\"\u003egelf-pretty\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003eCLI to pretty-print GELF log lines\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/joaodrp/gelf-pretty/releases/latest\"\u003e\n        \u003cimg alt=\"Release\" src=\"https://img.shields.io/github/release/joaodrp/gelf-pretty.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://travis-ci.com/joaodrp/gelf-pretty\"\u003e\n        \u003cimg alt=\"Travis\" src=\"https://img.shields.io/travis/com/joaodrp/gelf-pretty.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/joaodrp/gelf-pretty\"\u003e\n        \u003cimg alt=\"Codecov\"\n            src=\"https://img.shields.io/codecov/c/github/joaodrp/gelf-pretty/master.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/joaodrp/gelf-pretty\"\u003e\n        \u003cimg alt=\"Go Report\" src=\"https://goreportcard.com/badge/github.com/joaodrp/gelf-pretty\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://semver.org/\"\u003e\n        \u003cimg alt=\"SemVer\" src=\"https://img.shields.io/badge/semver-2.0.0-blue.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://conventionalcommits.org\"\u003e\n        \u003cimg alt=\"Conventional Commits\"\n            src=\"https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"LICENSE\"\u003e\n        \u003cimg alt=\"Software License\" src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://saythanks.io/to/joaodrp\"\u003e\n        \u003cimg alt=\"SayThanks.io\" src=\"https://img.shields.io/badge/say%20thanks-%E2%98%BC-1EAEDB.svg\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Introduction\n\nCLI tool to read \u003ca href=\"http://docs.graylog.org/en/latest/pages/gelf.html\"\u003eGraylog\nExtended Log Format (GELF)\u003c/a\u003e log lines from `stdin`, such as:\n\n```text\n{\"version\":\"1.1\",\"host\":\"my-server\",\"short_message\":\"Starting server\",\"timestamp\":1555690413.839,\"level\":6,\"_app\":\"my-app\",\"_logger\":\"api\",\"_port\":\"3000\"}\n{\"version\":\"1.1\",\"host\":\"my-server\",\"short_message\":\"Listening for requests\",\"timestamp\":1555690413.903,\"level\":6,\"_app\":\"my-app\",\"_logger\":\"api\",\"_endpoint\":\"locahost:3000/v1\"}\n{\"version\":\"1.1\",\"host\":\"my-server\",\"short_message\":\"Request received\",\"timestamp\":155569049.540,\"level\":6,\"_app\":\"my-app\",\"_logger\":\"api\",\"_method\":\"GET\",\"_path\":\"/todos/1\",\"_request_id\":\"0c4c165d\"}\n{\"version\":\"1.1\",\"host\":\"my-server\",\"short_message\":\"Response\",\"full_message\":\"{\\n\\t\\\"user_id\\\": 1,\\n\\t\\\"id\\\": 1,\\n\\t\\\"title\\\": \\\"fix /users/:id/todos route\\\",\\n\\t\\\"completed\\\": false\\n}\",\"timestamp\":155569049.584,\"level\":7,\"_app\":\"my-app\",\"_logger\":\"api\",\"_request_id\":\"0c4c165d\",\"_status\":200}\n{\"version\":\"1.1\",\"host\":\"my-server\",\"short_message\":\"Request received\",\"timestamp\":155569349.236,\"level\":6,\"_app\":\"my-app\",\"_logger\":\"api\",\"_method\":\"GET\",\"_path\":\"/users/1/todos\",\"_request_id\":\"0c4c165d\"}\n{\"version\":\"1.1\",\"host\":\"my-server\",\"short_message\":\"Unexpected error\",\"full_message\":\"runtime error: index out of range\\ngoroutine 1 [running]:\\nmain.main()\\n\\t/app/api/main.go: 9 +0x20\",\"timestamp\":155569349.563,\"level\":3,\"_app\":\"my-app\",\"_logger\":\"api\",\"_request_id\":\"0c4c165d\"}\n{\"version\":\"1.1\",\"host\":\"my-server\",\"short_message\":\"Server shutting down\",\"timestamp\":155569349.571,\"level\":4,\"_app\":\"my-app\",\"_logger\":\"api\"}\n```\n\nAnd pretty-print them to `stdout` like:\n\n![Demo](https://user-images.githubusercontent.com/484633/56434633-4eb7d900-62cd-11e9-8ff5-27d6f4931f7a.png)\n\n## Installation\n\nYou can install `gelf-pretty` using one of the following options:\n \n- Pre-built packages for macOS and Linux (easiest);\n- Pre-compiled binaries for macOS, Linux and Windows;\n- From source.\n\n### Pre-built packages\n#### macOS\n\nInstall via [Homebrew](https://brew.sh/):\n\n```bash\n$ brew install joaodrp/tap/gelf-pretty\n```\n\n#### Linux\n\nInstall via [Snapcraft](https://snapcraft.io/gelf-pretty): \n\n```bash\n$ snap install gelf-pretty\n```\n\nYou can also download `.deb` or `.rpm` packages from the [releases\npage](https://github.com/joaodrp/gelf-pretty/releases) and install with `dpkg\n-i` or `rpm -i` respectively.\n\n### Pre-compiled binaries\n\nDownload the correct archive for your platform from the [releases\npage](https://github.com/joaodrp/gelf-pretty/releases) and extract the\n`gelf-pretty` binary to a directory included in your `$PATH`/`Path`.\n\n### From source\n\n```bash\n$ go get -u github.com/joaodrp/gelf-pretty\n```\nMake sure that the `$GOPATH/bin` folder is in your `$PATH`.\n\n## Output Format\n\nGELF messages are pretty-printed in the following format:\n\n```text\n[\u003ctimestamp\u003e] \u003clevel\u003e: \u003c_app\u003e/\u003c_logger\u003e on \u003chost\u003e: \u003cshort_message\u003e \u003c_*\u003e=\u003cvalue\u003e\\n\n    \u003cfull_message\u003e\n```\n\n### Description\n- `\u003ctimestamp\u003e` is the value of the standard GELF unix `timestamp` field,\n  formatted as `2006-01-02 15:04:05.000`;\n\n- `\u003clevel\u003e` is the value of the standard GELF log `level` field, formatted in a\n  human-readable form (e.g. `DEBUG` instead of `7`);\n\n- `\u003c_app\u003e` is an optional *reserved* additional field. It can be used to\n  identify the name of the application emitting the logs. If not provided, the\n  forward slash that follows it is omitted;\n\n- `\u003c_logger\u003e` is an optional *reserved* additional field. It can be used to\n  identify the specific application module or logger instance that is emitting a\n  given log line;\n\n- `\u003chost\u003e` is the value of the standard GELF `host` field;\n\n- `\u003cshort_message\u003e` is the value of the standard GELF `short_message` field;\n\n- `\u003c_*\u003e=\u003cvalue\u003e` is any number of GELF additional fields (`_*`), formatted as\n  `key=value` pairs separated by a whitespace. The keys leading underscore is\n  omitted for readability;\n\n- `\u003cfull_message\u003e` is the value of the standard GELF `full_message` field\n  (usually used for exception backtraces). It is preceded by a new line and\n  indented with four spaces.\n\n### Colors\n\n`gelf-pretty` automatically detects if the output stream is a `TTY` or not. If\n(and only if) it is, the output will be formatted by default with ANSI colors\nfor improved readability.\n\n## Usage\n\nTo pretty-print GELF logs from your application simply pipe its output to\n`gelf-pretty`:\n\n```bash\n$ app | gelf-pretty\n```\n\nRun `gelf-pretty --help` for a list of available options:\n\n```bash\n$ gelf-pretty --help\nUsage of gelf-pretty:\n  --no-color\n        Disable color output\n  --version\n        Show version information\n```\n\n### Capture stderr\n\nIf your application writes to the `stderr` stream you will need to pipe it along\nwith `stdout`:\n\n```bash\n$ app 2\u003e\u00261 | gelf-pretty\n```\n\n### Disable colors\n\nTo disable colored output (even if the output stream is a `TTY`) use the\n`--no-color` option:\n\n```bash\n$ app | gelf-pretty --no-color\n```\n\n## FAQ\n\n### My logs are not formatted, why?\n\n`gelf-pretty` validates each input line. If a line (delimited by `\\n`) is not a\nvalid JSON string or is invalid according to the [GELF\nspecification](http://docs.graylog.org/en/latest/pages/gelf.html#gelf-payload-specification),\n`gelf-pretty` will simply echo it back to the `stdout` without any modification\n(silently, with no error messages).\n\nIf you believe that your log messages are valid, please [open a new\nissue](https://github.com/joaodrp/gelf-pretty/issues/new) and let us know.\n\n## Contributions\n\nThis project adheres to the Contributor Covenant [code of\nconduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this\ncode. Please refer to our [contributing guide](CONTRIBUTING.md) for further\ninformation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoaodrp%2Fgelf-pretty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoaodrp%2Fgelf-pretty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoaodrp%2Fgelf-pretty/lists"}