Class: SemanticLogger::Appender::Splunk
- Defined in:
- lib/semantic_logger/appender/splunk.rb
Overview
Note: This appender is Deprecated. Use: SemanticLogger::Appender::SplunkHttp
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#service_index ⇒ Object
readonly
Returns the value of attribute service_index.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options, level = :error, &block) ⇒ Splunk
constructor
DEPRECATED, Please use SemanticLogger::Appender::SplunkHttp.
-
#log(log) ⇒ Object
Log the message to Splunk.
-
#reopen ⇒ Object
After forking an active process call #reopen to re-open open the handles to resources.
Methods inherited from Base
colorized_formatter, #default_formatter, #flush, json_formatter, #level
Methods inherited from Base
#benchmark, default_level, default_level=, #fast_tag, #level, #level=, #payload, #pop_tags, #push_tags, #silence, #tagged, #tags, #with_payload
Constructor Details
#initialize(options, level = :error, &block) ⇒ Splunk
DEPRECATED, Please use SemanticLogger::Appender::SplunkHttp
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/semantic_logger/appender/splunk.rb', line 12 def initialize(, level=:error, &block) Kernel.warn('Splunk Appender is deprecated, please use SemanticLogger::Appender::SplunkHttp') # Parse input options for setting up splunk connection () reopen # Pass on the level and custom formatter if supplied super(level, &block) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/semantic_logger/appender/splunk.rb', line 9 def config @config end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
9 10 11 |
# File 'lib/semantic_logger/appender/splunk.rb', line 9 def index @index end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
9 10 11 |
# File 'lib/semantic_logger/appender/splunk.rb', line 9 def service @service end |
#service_index ⇒ Object (readonly)
Returns the value of attribute service_index.
9 10 11 |
# File 'lib/semantic_logger/appender/splunk.rb', line 9 def service_index @service_index end |
Instance Method Details
#log(log) ⇒ Object
Log the message to Splunk
35 36 37 38 39 40 41 |
# File 'lib/semantic_logger/appender/splunk.rb', line 35 def log(log) # Ensure minimum log level is met, and check filter return false if (level_index > (log.level_index || 0)) || !(log) # Submit the log message @service_index.submit(formatter.call(log, self)) true end |
#reopen ⇒ Object
After forking an active process call #reopen to re-open open the handles to resources
26 27 28 29 30 31 32 |
# File 'lib/semantic_logger/appender/splunk.rb', line 26 def reopen # Connect to splunk. Connect is a synonym for creating a Service by hand and calling login. @service = Splunk::connect(@config) # The index we are logging to @service_index = @service.indexes[@index] end |