No commit activity in last 3 years
No release in over 3 years
Remote syslog appender for Logging
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.9.2
>= 1.0.4
>= 2.10.0

Runtime

 Project Readme

logging/remote-syslog

logging/remote-syslog is a remote syslog appender for use with the Logging library. Travis CI Status

Installation

Add this line to your application's Gemfile: gem 'logging-remote-syslog', :require => 'logging/remote-syslog'

And then execute: $ bundle

Or install it yourself as: $ gem install logging-remote-syslog

Options

:ident - [String] Identity of the sender, such as a hostname or app ID
:syslog_server [String] - Syslog server hostname or IP (default: `127.0.0.1`)
:port [Integer] - Syslog server port (default: `514`)
:strip_colors [True|False] - Some loggers like shell colors, should we remove them? (default: `True`)
:facility [String] - A syslog facility name (default: `user`)
:modifier [Method] - A callback for altering the original message (takes original message; returns modified one)

Usage

require 'logging'
require 'logging/remote-syslog'

logger = Logging.logger['MyApp']
logger.add_appenders(
  Logging.appenders.remote_syslog(ident, syslog_server: syslog_host, port: syslog_port)
  )

logger.level = :info
logger.info 'MyApp Message'

Note that as shown above, a name is required as the first argument when adding the appender. (If an ident: options hash key is also provided, its value will be used as the sender instead of the name.)

Example

This registers a new appender named after the system's hostname. It will log to logs.example.com:1111.

require 'socket'
logger = Logging.logger['MyApp']
logger.add_appenders(
  Logging.appenders.remote_syslog(Socket.gethostname, syslog_server: 'logs.example.com', port: 1111)
  )

Tests

rake

Change Log

0.0.3 - Strip ANSI shell codes by default

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write code and add tests
  4. Commit your changes (git commit -am 'Added some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request