RAttab / luger

A direct-to-syslog logger over udp for Erlang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

luger

A direct-to-syslog logger over udp for Erlang.

The reason for yet-another-syslog-logger is that all existing implementation forward messages to a single process which, under heavy, load becomes a bottleneck and tends to build up a huge backlog in it's message queue which can take a long time to drain.

A call to luger's log function will directly send the log message over UDP to a syslog daemon. This approach offloads the queue management to the kernel which will simply drop UDP packets if it's ever overloaded.

Note that luger uses the undocumented inet_udp module to directly send UDP packets to the erlang inet driver while avoiding process queues. Use at your own risk and peril.

Build

make

Uses rebar under the hood so it can be easily included in any other rebar project.

Usage

Config for the application env can be one of the following:

{luger, [
  {app_name, "my-app"}
  {type, stderr}
]}
{luger, [
  {app_name, "my-app"}
  {type, syslog_udp},
  {syslog_udp_host, {127, 0, 0, 1}},
  {syslog_udp_port, 514},
  {syslog_udp_facility, 10}
]}

Addtional options:

  • max_msg_len: truncate long log message to this length. Setting this option to undefined removes the cap. Default value is 2048.

Once the application is set up, logging can be done like so:

luger:error("channel", "message: ~B", [10]),
luger:warn("channel", "message: ~p", [{blah}]),

That's it.

About

A direct-to-syslog logger over udp for Erlang

License:BSD 2-Clause "Simplified" License


Languages

Language:Erlang 99.0%Language:Makefile 1.0%