Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akasprzok/svadilfari
An Elixir Logger Backend for Grafana Loki.
https://github.com/akasprzok/svadilfari
elixir grafana-loki logger
Last synced: 2 months ago
JSON representation
An Elixir Logger Backend for Grafana Loki.
- Host: GitHub
- URL: https://github.com/akasprzok/svadilfari
- Owner: akasprzok
- License: mit
- Created: 2022-06-28T05:53:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-03T12:56:27.000Z (3 months ago)
- Last Synced: 2024-11-01T07:51:24.450Z (2 months ago)
- Topics: elixir, grafana-loki, logger
- Language: Elixir
- Homepage:
- Size: 57.6 KB
- Stars: 9
- Watchers: 2
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
![main](https://github.com/akasprzok/svadilfari/actions/workflows/main.yml/badge.svg?branch=main)
[![Hex](https://img.shields.io/hexpm/v/svadilfari.svg)](https://hex.pm/packages/svadilfari/)
[![Hex Docs](https://img.shields.io/badge/hex-docs-informational.svg)](https://hexdocs.pm/svadilfari/)
![License](https://img.shields.io/hexpm/l/svadilfari)
[![Coverage Status](https://coveralls.io/repos/github/akasprzok/svadilfari/badge.svg?branch=main)](https://coveralls.io/github/akasprzok/svadilfari?branch=main)# Svadilfari
A logger backend for sending logs directly to Grafana Loki.
## Installation
The package can be installed by adding `svadilfari` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:svadilfari, "~> 0.1"}
]
end# Also make sure it starts before :logger because logger uses it now
def application do
[
...
extra_applications: [..., :svadilfari, :logger, ...]
...
]
```Configure some parameters:
```elixir
config :logger, :backends, [:console, Svadilfari]# This setting is needed because Loki will complain if timestamps are too much off,
# and Logger sends timestamps without time zone information.
config :logger, utc_log: trueconfig :logger, :svadilfari,
metadata: [:user_id, :bogons],
max_buffer: 10,
client: [
url: "http://localhost:3100",
opts: [
org_id: "tenant1"
]
],
labels: [
{"service", "svadilfari"},
{"env", "dev"}
]
```and start sending logs to Loki!
## Documentation
For detailed documentation, configuration options, and examples, see [hex docs](https://hexdocs.pm/svadilfari).