0.0
No commit activity in last 3 years
No release in over 3 years
Log4r appender that outputs to LogDNA service.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
~> 10.0
~> 3.0

Runtime

~> 1.1.10
>= 1.0.9
 Project Readme

Log4r::Logdna

Log4r appender that outputs to LogDNA service. Sends all the Log4r logging context data as LogDNA data via the JSON API.

Installation

Add this line to your application's Gemfile:

gem 'log4r-logdna'

And then execute:

$ bundle

Or install it yourself as:

$ gem install log4r-logdna

Usage

Add the LogdnaOutputter to your log4r configuration:

  outputters:
    - type: LogdnaOutputter
      name: logdna_output

The LogDNA API key can be set with the logdna_key outputter option, or simply by setting the LOGDNA_KEY environment variable.

By default, the LogDNA env is detected using the RACK_ENV environment variable but can be changed via the Outputter configuration options.

The LogDNA app field is set to the name of the Log4r logger.

Since LogDNA shows the app name and log level outside of the message, an optimization is to use the PatternFormatter to drop the logger name and log level, such as:

  outputters:
    - type: LogdnaOutputter
      name: logdna_output
      formatter   :
        pattern     : '%m'
        type        : PatternFormatter

Supported optional Outputter options:

  logdna_key: LogDNA API key, if not using the LOGDNA_KEY environment variable
  hostname: Override auto-detected hostname 
  ip: Send IP information to LogDNA
  mac: Send MAC information to LogDNA
  env: Override auto-detected RACK_ENV value

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/LeadDyno/log4r-logdna.

License

The gem is available as open source under the terms of the MIT License.