Class: Fluent::SplunkTCPOutput
- Inherits:
-
ObjectBufferedOutput
- Object
- ObjectBufferedOutput
- Fluent::SplunkTCPOutput
- Defined in:
- lib/fluent/plugin/out_splunk_tcp.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #implement?(feature) ⇒ Boolean
- #multi_workers_ready? ⇒ Boolean
- #shutdown ⇒ Object
- #start ⇒ Object
-
#use_ssl ⇒ Object
For SSL.
- #write_objects(_tag, chunk) ⇒ Object
Instance Method Details
#configure(conf) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/fluent/plugin/out_splunk_tcp.rb', line 45 def configure(conf) super case @time_format when 'unixtime' @time_formatter = lambda {|time| time } else @timef = Fluent::TimeFormatter.new(@time_format, @localtime) @time_formatter = lambda {|time| @timef.format(time) } end case @format when 'json' if @use_fluentd_time @formatter = lambda {|time, record| Yajl.dump(insert_time_to_front(time, record)) } else @formatter = lambda {|_time, record| Yajl.dump(record) } end when 'kv' if @use_fluentd_time @formatter = lambda {|time, record| format_kv(insert_time_to_front(time, record)) } else @formatter = lambda {|_time, record| format_kv(record) } end when 'raw' unless @event_key raise ConfigError, "'event_key' option is required for format 'raw'" end @formatter = lambda {|_time, record| record[@event_key] || '' } else raise ConfigError, "invalid 'format' option: #{@format}" end end |
#implement?(feature) ⇒ Boolean
38 39 40 41 42 43 |
# File 'lib/fluent/plugin/out_splunk_tcp.rb', line 38 def implement?(feature) if feature == :custom_format return false end super end |
#multi_workers_ready? ⇒ Boolean
79 80 81 |
# File 'lib/fluent/plugin/out_splunk_tcp.rb', line 79 def multi_workers_ready? true end |
#shutdown ⇒ Object
87 88 89 |
# File 'lib/fluent/plugin/out_splunk_tcp.rb', line 87 def shutdown super end |
#start ⇒ Object
83 84 85 |
# File 'lib/fluent/plugin/out_splunk_tcp.rb', line 83 def start super end |
#use_ssl ⇒ Object
For SSL
31 |
# File 'lib/fluent/plugin/out_splunk_tcp.rb', line 31 config_param :use_ssl, :bool, default: false |
#write_objects(_tag, chunk) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/fluent/plugin/out_splunk_tcp.rb', line 91 def write_objects(_tag, chunk) return if chunk.empty? payload = '' chunk.msgpack_each do |time, record| event = @formatter.call(time, record) unless event.empty? payload << event payload << @line_breaker end end unless payload.empty? sock = create_socket sock.write(payload) sock.close end end |