Class: Fluent::Kaboom
- Inherits:
-
Output
- Object
- Output
- Fluent::Kaboom
- Defined in:
- lib/out_kaboom.rb,
lib/fluent/plugin/out_kaboom.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/out_kaboom.rb', line 18 def configure(conf) super @record_exploder = RecordExploder.new(ValuesRetriever.new) @tag_updater = TagUpdater.new @keys_validator = KeysValidator.new key_pattern = "^([^\\\"\\.]+\\.)*[^\\\"\.]+$" key_regex = Regexp.new(key_pattern) if (!@tag && !@add_tag_prefix && !@remove_tag_prefix) raise ConfigError, "One of tag, add_tag_prefix, or remove_tag_prefix must be set. remove_tag_prefix and add_tag_prefix may be used together." elsif (@tag && (@add_tag_prefix || @remove_tag_prefix)) raise ConfigError, "tag can not be used in conjunction with add_tag_prefix or remove_tag_prefix; the former would override the latter." elsif (!@key.match(key_pattern)) raise ConfigError, "key is malformed; it should consist of dot-separated field names like foo.bar.baz or \"f.oo\".bar.baz if part of your key contains dots." end end |
#emit(tag, es, chain) ⇒ Object
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 |
# File 'lib/out_kaboom.rb', line 46 def emit(tag, es, chain) chain.next new_tag = tag if (@tag) new_tag = @tag else new_tag = @tag_updater.update_tag(tag, @remove_tag_prefix, @add_tag_prefix) end keys = key.split(".") es.each do |time,record| new_records = [] if (@keys_validator.keys_are_valid?(keys, record) === false) new_records = [record] else new_records = @record_exploder.explode_record(keys, record) end new_records.each do |record| router.emit(new_tag, time, record) end end end |
#shutdown ⇒ Object
42 43 44 |
# File 'lib/out_kaboom.rb', line 42 def shutdown super end |
#start ⇒ Object
38 39 40 |
# File 'lib/out_kaboom.rb', line 38 def start super end |