Class: Fluent::Plugin::SimpleTsvFormatter
- Inherits:
-
Formatter
- Object
- Formatter
- Fluent::Plugin::SimpleTsvFormatter
- Defined in:
- lib/fluent/plugin/formatter_simple_tsv.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/fluent/plugin/formatter_simple_tsv.rb', line 12 def configure(conf) super if @keys.empty? raise Fluent::ConfigError, "keys option is required on simple_tsv formatter" end end |
#format(tag, time, record) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fluent/plugin/formatter_simple_tsv.rb', line 20 def format(tag, time, record) selected = record.select {|key, val| @keys.include?(key) } formatted = selected.inject('') { |result, pair| result << "\t" if result.length.nonzero? result << "#{pair.last}" } formatted << "\n" formatted end |