Skip to content

Instantly share code, notes, and snippets.

@fujiwara
Last active February 7, 2020 13:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fujiwara/360f6587e4e6ce082e2f9c1f67c873f3 to your computer and use it in GitHub Desktop.
fix fluentd tags from firelens
<match *-firelens-*>
@type firelens_tag_filter
</match>
<match app.firelens.**>
# ...
</match>
require "fluent/plugin/output"
class Fluent::Plugin::FirelensTagFilterOutput < Fluent::Plugin::Output
Fluent::Plugin.register_output('firelens_tag_filter', self)
helpers :event_emitter
def process(tag, es)
rewrited_tag = tag.gsub(/^(.*?)-firelens-(.*)/, '\1.firelens.\2')
router.emit_stream(rewrited_tag, es)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment