Class: TagUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/tag_updater.rb

Instance Method Summary collapse

Instance Method Details

#update_tag(tag, remove_tag_prefix, add_tag_prefix) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fluent/plugin/tag_updater.rb', line 3

def update_tag(tag, remove_tag_prefix, add_tag_prefix)
	new_tag = tag

	if (remove_tag_prefix && tag.start_with?(remove_tag_prefix))
		new_tag = new_tag.sub(remove_tag_prefix, "")
	end

	if (add_tag_prefix)
		new_tag = "#{add_tag_prefix}#{new_tag}"
	end

	new_tag
end