Lager backend for sending logs to Logstash.
Includes lager_logstash_json_formatter
which can be used with other
lager
backends.
Add lager_logstash
to your rebar.config
deps:
{deps,
[
{lager_logstash, "",
{git, "https://github.com/rpt/lager_logstash.git",
{tag, "0.1.3"}}}
]}.
Remember to also add jsx
or jiffy
, whichever you prefer.
And finally, configure lager
app with something like this:
[
{lager,
[
{handlers,
[
{lager_logstash_backend,
[
{level, info},
{output, {tcp, "localhost", 5000}},
%% {output, {udp, "localhost", 5000}},
%% {output, {file, "/var/log/lager_logstash.log"}},
{format, json},
{json_encoder, jsx}
]}
]}
]}
].
- outputs:
tcp
,udp
,file
- formats:
json
- json encoders:
jsx
,jiffy
Here's how you would use the included JSON formatter with the
lager_file_backend
:
{lager_file_backend,
[
{file, "log/lager_logstash.log"},
{level, info},
{formatter, lager_logstash_json_formatter},
{formatter_config, [{json_encoder, jsx}]},
{size, 10485760},
{date, "$D0"},
{count, 5}
]}
- reconnect
- other formats
- Small fixes
- Removes all release name/version logging code
- Adds
lager_logstash_json_formatter