Class: LogStasher::Device::Syslog
- Inherits:
-
Object
- Object
- LogStasher::Device::Syslog
- Includes:
- LogStasher::Device
- Defined in:
- lib/logstasher/device/syslog.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #facility ⇒ Object
- #flags ⇒ Object
- #identity ⇒ Object
-
#initialize(options = {}) ⇒ Syslog
constructor
A new instance of Syslog.
- #priority ⇒ Object
- #write(log) ⇒ Object
Methods included from LogStasher::Device
Constructor Details
#initialize(options = {}) ⇒ Syslog
Returns a new instance of Syslog.
13 14 15 16 17 18 |
# File 'lib/logstasher/device/syslog.rb', line 13 def initialize( = {}) = .merge(stringify_keys()) @options = () open_syslog end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/logstasher/device/syslog.rb', line 11 def @options end |
Instance Method Details
#close ⇒ Object
20 21 22 |
# File 'lib/logstasher/device/syslog.rb', line 20 def close ::Syslog.close rescue nil end |
#closed? ⇒ Boolean
24 25 26 |
# File 'lib/logstasher/device/syslog.rb', line 24 def closed? !::Syslog.opened? end |
#facility ⇒ Object
28 29 30 |
# File 'lib/logstasher/device/syslog.rb', line 28 def facility ['facility'] end |
#flags ⇒ Object
32 33 34 |
# File 'lib/logstasher/device/syslog.rb', line 32 def flags ['flags'] end |
#identity ⇒ Object
36 37 38 |
# File 'lib/logstasher/device/syslog.rb', line 36 def identity ['identity'] end |
#priority ⇒ Object
40 41 42 |
# File 'lib/logstasher/device/syslog.rb', line 40 def priority ['priority'] end |
#write(log) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/logstasher/device/syslog.rb', line 44 def write(log) fail ::RuntimeError, 'Syslog has been closed.' if closed? fail ::RuntimeError, 'Syslog re-configured unexpectedly.' if syslog_config_changed? ::Syslog.log(priority, '%s', log) end |