Module: Fluent::HandleTagNameMixin
- Includes:
- RecordFilterMixin
- Defined in:
- lib/fluent/mixin.rb
Instance Attribute Summary collapse
-
#add_tag_prefix ⇒ Object
Returns the value of attribute add_tag_prefix.
-
#add_tag_suffix ⇒ Object
Returns the value of attribute add_tag_suffix.
-
#remove_tag_prefix ⇒ Object
Returns the value of attribute remove_tag_prefix.
-
#remove_tag_suffix ⇒ Object
Returns the value of attribute remove_tag_suffix.
Instance Method Summary collapse
Methods included from RecordFilterMixin
Instance Attribute Details
#add_tag_prefix ⇒ Object
Returns the value of attribute add_tag_prefix.
101 102 103 |
# File 'lib/fluent/mixin.rb', line 101 def add_tag_prefix @add_tag_prefix end |
#add_tag_suffix ⇒ Object
Returns the value of attribute add_tag_suffix.
101 102 103 |
# File 'lib/fluent/mixin.rb', line 101 def add_tag_suffix @add_tag_suffix end |
#remove_tag_prefix ⇒ Object
Returns the value of attribute remove_tag_prefix.
101 102 103 |
# File 'lib/fluent/mixin.rb', line 101 def remove_tag_prefix @remove_tag_prefix end |
#remove_tag_suffix ⇒ Object
Returns the value of attribute remove_tag_suffix.
101 102 103 |
# File 'lib/fluent/mixin.rb', line 101 def remove_tag_suffix @remove_tag_suffix end |
Instance Method Details
#configure(conf) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/fluent/mixin.rb', line 102 def configure(conf) super if remove_tag_prefix = conf['remove_tag_prefix'] @remove_tag_prefix = Regexp.new('^' + Regexp.escape(remove_tag_prefix)) end if remove_tag_suffix = conf['remove_tag_suffix'] @remove_tag_suffix = Regexp.new(Regexp.escape(remove_tag_suffix) + '$') end @add_tag_prefix = conf['add_tag_prefix'] @add_tag_suffix = conf['add_tag_suffix'] end |
#filter_record(tag, time, record) ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/fluent/mixin.rb', line 116 def filter_record(tag, time, record) tag.sub!(@remove_tag_prefix, '') if @remove_tag_prefix tag.sub!(@remove_tag_suffix, '') if @remove_tag_suffix tag.insert(0, @add_tag_prefix) if @add_tag_prefix tag << @add_tag_suffix if @add_tag_suffix super(tag, time, record) end |