Class: Logging::Appenders::Logstash
- Inherits:
-
Logging::Appender
- Object
- Logging::Appender
- Logging::Appenders::Logstash
- Defined in:
- lib/logging/appenders/logstash.rb
Overview
This class provides an Appender that can write to remote syslog.
Constant Summary collapse
- ID_REG_EXP =
/_id$/
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, opts = {}) ⇒ Logstash
constructor
call: Logstash.new( name, opts = {} ).
Constructor Details
#initialize(name, opts = {}) ⇒ Logstash
call:
Logstash.new( name, opts = {} )
Create an appender that will log messages to logstash. The options that can be used to configure the appender are as follows:
it accepts all options of logstash logger: github.com/dwbutler/logstash-logger
28 29 30 31 32 |
# File 'lib/logging/appenders/logstash.rb', line 28 def initialize(name, opts = {}) @host=opts.delete(:host) || Socket.gethostname @logstash_device=LogStashLogger::Device.new(opts) super end |
Class Method Details
.num_to_level(level_num) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/logging/appenders/logstash.rb', line 13 def self.num_to_level(level_num) @level_nums ||= Loggin::LEVELS..inject({}) do |hash, kv| hash[kv[1]] = kv[0]; hash end @level_nums[level_num] end |