https://github.com/aronisstav/ejsonlog
A drop-in logger formatter for Erlang that outputs messages as line delimited JSON.
https://github.com/aronisstav/ejsonlog
Last synced: 3 months ago
JSON representation
A drop-in logger formatter for Erlang that outputs messages as line delimited JSON.
- Host: GitHub
- URL: https://github.com/aronisstav/ejsonlog
- Owner: aronisstav
- License: apache-2.0
- Created: 2021-03-23T09:52:08.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-23T18:00:51.000Z (about 4 years ago)
- Last Synced: 2025-01-21T01:30:05.762Z (4 months ago)
- Language: Erlang
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ejsonlog
A drop-in logger formatter for Erlang that outputs messages as line
delimited JSON.## Overview
This formatter is heavily inspired by [flatlog][flatlog], but it is
meant to produce JSON logs.It does not impose a specific "Erlang term to JSON" formatter and can
be configured to use the one you prefer.Just like [flatlog][flatlog], this formatter should not be added as a
dependency in individual libraries.## Configuration
For configuration instructions, generate and read the Edoc
documentation.## Caveats
Due to Erlang's logger design, log messages are fully generated by the
processes that call logging commands, before they are sent to a
backend e.g. for writing them on a file.As a result, if `ejsonlog` is used together with [Loki][loki] and
[promtail][promtail], the `time` field should **not** be used to
overwrite the default timestamp generated by promtail, as log lines
may end up out-of-order in files.## Build
$ rebar3 compile
## Acknowledgements
This project was created as part of Erlang Solutions' Hackathon on
2021-03-23.[flatlog]: https://github.com/ferd/flatlog
[loki]: https://grafana.com/oss/loki
[promtail]: https://grafana.com/docs/loki/latest/clients/promtail