{"id":13508486,"url":"https://github.com/LeeroyDing/json_logger","last_synced_at":"2025-03-30T11:32:04.110Z","repository":{"id":31707236,"uuid":"35272976","full_name":"LeeroyDing/json_logger","owner":"LeeroyDing","description":"Simple JSON Logger for Elixir apps.","archived":false,"fork":false,"pushed_at":"2020-04-05T21:19:28.000Z","size":18,"stargazers_count":24,"open_issues_count":2,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T06:58:30.938Z","etag":null,"topics":[],"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/LeeroyDing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-08T10:18:53.000Z","updated_at":"2023-08-20T16:44:49.000Z","dependencies_parsed_at":"2022-09-26T17:50:51.607Z","dependency_job_id":null,"html_url":"https://github.com/LeeroyDing/json_logger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeeroyDing%2Fjson_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeeroyDing%2Fjson_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeeroyDing%2Fjson_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeeroyDing%2Fjson_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeeroyDing","download_url":"https://codeload.github.com/LeeroyDing/json_logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314011,"owners_count":20757450,"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":[],"created_at":"2024-08-01T02:00:53.779Z","updated_at":"2025-03-30T11:31:59.100Z","avatar_url":"https://github.com/LeeroyDing.png","language":"Elixir","funding_links":[],"categories":["Logging"],"sub_categories":[],"readme":"Elixir JSON Logger\n==================\n\nJSON Logger is a logger backend that outputs elixir logs in JSON format.\n\nThis project is originally designed to make Elixir apps work with Logstash easily. It aims at providing as much information for the log is possible, so the logs can be more easily analyzed by backend services like _Elasticsearch_.\n\nIssues and PRs are welcome.\n\n## Dependencies\n\nThis project requires [json](https://hex.pm/packages/json).\n\n## Configuration\n\n### Elixir Project\n\nJSON Logger currently provides very few options:\n\n* __level__: The minimal level of logging. There's no default of this option. Example: `level: :warn`\n* __output__: The output of the log. Must be either `:console` or `{:udp, host, port}` or `{:tcp, host, port}. Example: `output: {:udp, \"localhost\", 514}`\n* __metadata__: Whatever else you want in the log. Example: `metadata: \"Some very important project\"`\n\nExample configuration: `config :logger, :json_logger, level: :info, output: {:udp, \"localhost\", 514}`\n\n**TCP support is still experimental, please submit issues that you encounter.**\n\n\n### In your application\n\nYou should add `json_logger` to your `mix.exs` as well. This step may not be necessary (if you know why please tell me).\n\n```elixir\ndefmodule MyMod.Mixfile do\n  # ...\n  def application do\n    [applications: [:logger, :json_logger],\n     mod: {MyMod, []}]\n  end\n  # ...\nend\n```\n\n### Adding the logger backend\n\nYou need to add this backend to your `Logger`, preferably put this in your `Application`'s `start/2`.\n\n```elixir\nLogger.add_backend Logger.Backends.JSON\n```\n\n### If you wish to use Logstash with this library\n\nHere is an example logstash configuration:\n\n```\ninput {\n  udp {\n    port =\u003e 514\n    type =\u003e \"elixir_json_logging\"\n  }\n}\n\nfilter {\n  json {\n    source =\u003e \"message\"\n  }\n}\n\noutput {\n  stdout {\n    codec =\u003e rubydebug\n  }\n}\n```\n\nNote that this configuration will probably break on your system (listening to a \u003c1024 port). You **should** change the \"port\" to a larger value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeeroyDing%2Fjson_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLeeroyDing%2Fjson_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeeroyDing%2Fjson_logger/lists"}