Class: Fluent::SplunkExOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::SplunkExOutput
- Includes:
- SetTagKeyMixin, SetTimeKeyMixin
- Defined in:
- lib/fluent/plugin/out_splunk_ex.rb
Constant Summary collapse
- SOCKET_TRY_MAX =
3
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
28 29 30 |
# File 'lib/fluent/plugin/out_splunk_ex.rb', line 28 def configure(conf) super end |
#emit(tag, es, chain) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/fluent/plugin/out_splunk_ex.rb', line 63 def emit(tag, es, chain) chain.next es.each {|time,record| @send_data.call( @format_fn.call(record) ) } end |
#shutdown ⇒ Object
55 56 57 58 59 60 |
# File 'lib/fluent/plugin/out_splunk_ex.rb', line 55 def shutdown super if !@test_mode && @splunk_connection.respond_to?(:close) @splunk_connection.close end end |
#start ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fluent/plugin/out_splunk_ex.rb', line 32 def start super if @output_format == 'kv' @format_fn = self.class.method(:format_kv) else @format_fn = self.class.method(:format_json) end if @test_mode @send_data = proc { |text| log.trace("test mode text: #{text}") } else begin @splunk_connection = TCPSocket.open(@host, @port) rescue Errno::ECONNREFUSED # we'll try again when data is sent end @send_data = self.method(:splunk_send) end end |