{"id":19725674,"url":"https://github.com/esl/logger_graylog_backend","last_synced_at":"2025-04-30T00:31:31.491Z","repository":{"id":40994133,"uuid":"117221739","full_name":"esl/logger_graylog_backend","owner":"esl","description":"Elixir's Logger backend for Graylog","archived":false,"fork":false,"pushed_at":"2023-02-01T11:50:29.000Z","size":27,"stargazers_count":7,"open_issues_count":1,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T20:22:55.665Z","etag":null,"topics":["elixir","gelf","graylog","logger","logger-backend"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esl.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":"2018-01-12T09:31:14.000Z","updated_at":"2024-12-29T03:32:25.000Z","dependencies_parsed_at":"2024-11-11T23:33:06.354Z","dependency_job_id":"74d76720-2257-4283-a9fd-be225e8a9c4a","html_url":"https://github.com/esl/logger_graylog_backend","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esl%2Flogger_graylog_backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esl%2Flogger_graylog_backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esl%2Flogger_graylog_backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esl%2Flogger_graylog_backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esl","download_url":"https://codeload.github.com/esl/logger_graylog_backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251607770,"owners_count":21616834,"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":["elixir","gelf","graylog","logger","logger-backend"],"created_at":"2024-11-11T23:32:29.715Z","updated_at":"2025-04-30T00:31:30.956Z","avatar_url":"https://github.com/esl.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"## LoggerGraylogBackend\n\nThis application provides a [Logger](https://hexdocs.pm/logger) backend for sendings log messages\nto Graylog. Currently only TCP transport is supported, and logs are always formatted in\n[GELF](http://docs.graylog.org/en/stable/pages/gelf.html) format.\n\n### Installation\n\nThis library is not available on Hex (yet). You need to pull it directly from GitHub:\n\n```elixir\ndef deps do\n  [{:logger_graylog_backend, github: \"esl/logger_graylog_backend\", tag: \"v0.1.0\"}, ...]\nend\n```\n\n### Usage\n\nFirst you need to tell `Logger` to install this backend:\n\n```elixir\nconfig :logger, backends: [LoggerGraylogBackend.Tcp]\n```\n\nand then configure the backend itself:\n\n```elixir\nconfig :logger, LoggerGraylogBackend.Tcp,\n  host: \"your-graylog-hostname\",\n  port: 12201,\n  # other options...\n```\n\nAnd that's it! Note that if the TCP backend won't be able to connect to the Graylog instance, it\nwill try reconnecting indefinitely (with backoff).\n\n### Backend configuration\n\nThere are couple of configuration values you can provide to the backend:\n\n* `:host` (**required**) - host name or IP address (basically everything accepted by `gen_tcp:connect/3`)\n   of the Graylog instance\n* `:port` (**required**) - port which the Graylog instance accepts TCP connections on\n* `:level` (**optional**, default: `info`) - the log level (`:debug`, `:info`, `:warn` or `:error`)\n\n### Formatter\n\nLogs sent by the backend are always in GELF 1.1 format. The following fields are included in the\npayload by default:\n\n* `\"version\"` - always has value `\"1.1\"`\n* `\"host\"` - hostname retrieved using `inet:gethostname/0` (might be overriden)\n* `\"timestamp\"` - the log timestamp in seconds and milliseconds as fractional part (can be excluded)\n* `\"short_message\"` - the log message\n* `\"level\"` - the log severity formatted as a number as in [syslog](https://en.wikipedia.org/wiki/Syslog#Severity_level)\n\nIn addition, all metadata provided by Logger will be included as additional fields (thus prefixed\nwith `_`). What metadata is included in the message is also configurable.\n\n#### Conifugration\n\nYou can configure the formatter using the following options:\n\n* `:include_timestamp` (default: `true`) - tells the formatted to include the `\"timestamp\"` field.\n  Note that Graylog generates the timestamp itself if the incoming log message doesn't have it\n* `:override_host` (default: `false`)- if set, the `\"host\"` field in the GELF log will have the\n  configured value. Might be set to `false` to make the formatter use system hostname\n* `:metadata` (default: `:all`) - filters what metadata will be included in the message, possible\n  values are:\n  * `:all` - all metadata\n  * list of atoms - only metadata with keys present in the provided list\n  * `{module, function}` - a module/function pair which will be called when generatin the GELF\n    message. The function should take four arguments (log level, log message, timestamp and\n    all metadata) and return the metadata which will be included in the message\n\n### Example configuration\n\n```elixir\nconfig :logger, backends: [LoggerGraylogBackend.Tcp]\n\nconfig :logger, LoggerGraylogBackend.Tcp,\n  host: \"example.com\",\n  port: 12201,\n  level: :warn,\n  include_timestamp: false,\n  override_host: \"my-app\",\n  metadata: [:application, :file, :line]\n```\n\n### License\n\nCopyright 2018 Erlang Solutions\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesl%2Flogger_graylog_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesl%2Flogger_graylog_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesl%2Flogger_graylog_backend/lists"}