Skip to content

Latest commit

 

History

History
92 lines (68 loc) · 1.68 KB

README.md

File metadata and controls

92 lines (68 loc) · 1.68 KB

lager_logstash 0.1.3 Build Status

Lager backend for sending logs to Logstash.

Includes lager_logstash_json_formatter which can be used with other lager backends.

Configuration

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}
      ]}
    ]}
  ]}
].

Features

  • outputs: tcp, udp, file
  • formats: json
  • json encoders: jsx, jiffy

JSON formatter

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}
 ]}

TODOs

  • reconnect
  • other formats

Changelog

0.1.3

  • Small fixes

0.1.2

  • Removes all release name/version logging code

0.1.1

  • Adds lager_logstash_json_formatter