An open API service indexing awesome lists of open source software.

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.

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