{"id":20882073,"url":"https://github.com/wardbekker/lokilogger","last_synced_at":"2025-05-12T17:31:23.464Z","repository":{"id":35059039,"uuid":"201794921","full_name":"wardbekker/LokiLogger","owner":"wardbekker","description":"Elixir Logger Backend for Grafana Loki","archived":false,"fork":false,"pushed_at":"2022-03-31T11:22:41.000Z","size":33,"stargazers_count":11,"open_issues_count":4,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-15T21:38:27.313Z","etag":null,"topics":["elixir","grafana","logging","loki"],"latest_commit_sha":null,"homepage":null,"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/wardbekker.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":"2019-08-11T17:29:45.000Z","updated_at":"2024-08-14T19:43:08.000Z","dependencies_parsed_at":"2022-08-08T04:15:40.546Z","dependency_job_id":null,"html_url":"https://github.com/wardbekker/LokiLogger","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/wardbekker%2FLokiLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wardbekker%2FLokiLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wardbekker%2FLokiLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wardbekker%2FLokiLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wardbekker","download_url":"https://codeload.github.com/wardbekker/LokiLogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225144753,"owners_count":17427857,"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","grafana","logging","loki"],"created_at":"2024-11-18T07:28:54.593Z","updated_at":"2024-11-18T07:28:55.144Z","avatar_url":"https://github.com/wardbekker.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LokiLogger\n\nLokiLogger is an Elixir logger backend providing support for Logging to [Grafana Loki](https://github.com/grafana/loki)\n\n[![Hex.pm Version](http://img.shields.io/hexpm/v/loki_logger.svg?style=flat)](https://hex.pm/packages/loki_logger)\n\n## Known issues\n\n* \"works-on-my-machine\" level of quality. Love to get your feedback in the repo's Github issues\n\n## Features (and TODO)\n\n* [x] Elixir Logger formatting\n* [x] Elixir Logger metadata\n    * [x] Loki Scope-Org-Id header for multi-tenancy\n* [x] Timezone aware\n* [X] Snappy compressed proto format in the HTTP Body  \n* [ ] Async http call to backend.\n* [ ] Proper unit tests.\n* [ ] HTTP post retry strategy on temporary loki backend failure or network hiccups.\n* [ ] Authentication with basic auth and/or Oauth2 reverse proxy.\n* [ ] CI build integration (e.g. TravisCI) \n\n## Installation\n\nThe package can be installed by adding `loki_logger` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:loki_logger, \"~\u003e 0.3.0\"}\n  ]\nend\n```\n\n## Configuration\n\n### Elixir Project\n\nLoki Logger's behavior is controlled using the application configuration environment:\n\n* __loki_host__ : the hostname of the syslog server e.g. http://localhost:3100\n* __loki_labels__ : the Loki log labels used to select the log stream in e.g. Grafana \n* __loki_scope_org_id__: optional tenant ID for multitenancy. Currently not (yet?) supported in Grafana when enforced with `auth_enabled: true` in Loki config \n* __level__: logging threshold. Messages \"above\" this threshold will be discarded. The supported levels, ordered by precedence are :debug, :info, :warn, :error.\n* __format__: the format message used to print logs. Defaults to: \"$metadata level=$level $levelpad$message\". It may also be a {module, function} tuple that is invoked with the log level, the message, the current timestamp and the metadata.\n* __metadata__: the metadata to be printed by $metadata. Defaults to to :all, which prints all metadata.\n* __max_buffer__: the amount of entries to buffer before posting to the Loki REST api. Defaults to 32.  \n\nFor example, the following `config/config.exs` file sets up Loki Logger using\nlevel debug, with `application` label `loki_logger_library`. \n\n```elixir\nuse Mix.Config\n\nconfig :logger,\n       backends: [LokiLogger]\n\nconfig :logger, :loki_logger,\n       level: :debug,\n       format: \"$metadata level=$level $levelpad$message\",\n       metadata: :all,\n       max_buffer: 300,\n       loki_labels: %{application: \"loki_logger_library\", elixir_node: node()},\n       loki_host: \"http://localhost:3100\"\n```\n\n# Protobuff lib regeneration\n\nonly needed for development \n\n```shell script\nprotoc --proto_path=./lib/proto --elixir_out=./lib lib/proto/loki.proto \n```\n\n## License\n\nLoki Logger is copyright (c) 2019 Ward Bekker \n\nThe source code is released under the Apache v2.0 License.\n\nCheck [LICENSE](LICENSE) for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwardbekker%2Flokilogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwardbekker%2Flokilogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwardbekker%2Flokilogger/lists"}