Class: LogStash::Outputs::CSV
- Defined in:
- lib/logstash/outputs/csv.rb
Overview
CSV output.
Write events to disk in CSV or other delimited format Based on the file output, many config values are shared Uses the Ruby csv library internally
Constant Summary
Constants included from Config::Mixin
Instance Attribute Summary
Attributes included from Config::Mixin
Attributes inherited from Plugin
Instance Method Summary collapse
Methods inherited from File
Methods inherited from Base
#handle, #handle_worker, #initialize, #worker_setup, #workers_not_supported
Methods included from Config::Mixin
Methods inherited from Plugin
#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s
Constructor Details
This class inherits a constructor from LogStash::Outputs::Base
Instance Method Details
#receive(event) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/logstash/outputs/csv.rb', line 33 def receive(event) return unless output?(event) path = event.sprintf(@path) fd = open(path) csv_values = @fields.map {|name| get_value(name, event)} fd.write(csv_values.to_csv(@csv_options)) flush(fd) close_stale_files end |
#register ⇒ Object
27 28 29 30 |
# File 'lib/logstash/outputs/csv.rb', line 27 def register super @csv_options = Hash[@csv_options.map{|(k,v)|[k.to_sym, v]}] end |