Class: Fluent::Tai64nParserOutput

Inherits:
Output
  • Object
show all
Includes:
HandleTagNameMixin, Tai64nParserMixin
Defined in:
lib/fluent/plugin/out_tai64n_parser.rb

Instance Method Summary collapse

Methods included from Tai64nParserMixin

#parse_tai64n, #try_replace_tai64n

Instance Method Details

#configure(conf) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fluent/plugin/out_tai64n_parser.rb', line 22

def configure(conf)
  super
  if (
      !remove_tag_prefix &&
      !remove_tag_suffix &&
      !add_tag_prefix    &&
      !add_tag_suffix
  )
    raise ConfigError, "out_tai64n_parser: At least one of remove_tag_prefix/remove_tag_suffix/add_tag_prefix/add_tag_suffix is required to be set."
  end
  @output_key ||= @key
end

#emit(tag, es, chain) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/fluent/plugin/out_tai64n_parser.rb', line 43

def emit(tag, es, chain)
  es.each {|time,record|
    t = tag.dup
    filter_record(t, time, record)
    router.emit(t, time, record)
  }
  chain.next
end

#filter_record(tag, time, record) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/fluent/plugin/out_tai64n_parser.rb', line 52

def filter_record(tag, time, record)
  begin
    record[output_key] = try_replace_tai64n(record[key])
  rescue => e
    log.warn("out_tai64n_parser: #{e.class} #{e.message}")
    log.warn_backtrace
  end
  super(tag, time, record) # HandleTagNameMixin
end

#shutdownObject



39
40
41
# File 'lib/fluent/plugin/out_tai64n_parser.rb', line 39

def shutdown
  super
end

#startObject



35
36
37
# File 'lib/fluent/plugin/out_tai64n_parser.rb', line 35

def start
  super
end