Skip to content

Instantly share code, notes, and snippets.

@fujiwara
Last active February 7, 2020 13:00
Show Gist options
  • Save fujiwara/360f6587e4e6ce082e2f9c1f67c873f3 to your computer and use it in GitHub Desktop.
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