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