fluent-plugin-rewrite icon indicating copy to clipboard operation
fluent-plugin-rewrite copied to clipboard

Allow to not modify the tag

Open kayrus opened this issue 8 years ago • 1 comments

I want just to strip all newlines in logs, but with the current behavior it'll require rewriting all my rules, because it requires tag modification. I don't want to modify it. Here is the config which I used

<match **>
  type rewrite
  <rule>
    key     log
    pattern $\n
    replace
  </rule>
</match>

This rule breaks whole configuration. No logs at all.

Then I decided to use an empty string:

<match **>
  type rewrite
  add_prefix   ""
  <rule>
    key     log
    pattern $\n
    replace
  </rule>
</match>

And it added a dot prefix, so all my further rules stopped working, nut at least logs started to be processed.

When I enabled warnings, I saw Can not emit message because the tag(foo.bar) has not changed. Dropped record. So how can I modify records without adding a tag prefix? Looks like this condition doesn't allow that even when you set:

  remove_prefix foo
  add_prefix    foo

kayrus avatar Oct 19 '16 08:10 kayrus

AFAIK, there is no way to modify record without tag modifications in this plugin. If this plugin would support filter version, we could modify record without tag manipulations with filter version of this plugin. Since v0.12, Fluentd has label feature. So, plugin developers and contributors no need to support tag modification for routing purposes in filter plugin (still should support this kind of operations in output type plugin).

cosmo0920 avatar Oct 19 '16 09:10 cosmo0920