I want to output all in null, except the one pattern in match. I know there are some ways to do that via @labels for example, but i exactly want to exclude pattern in match.
I want to do like this:
<match {all tags except **events**}>
What i did:
I know i can use Ruby expressions in match like this:
<match #{tag.match(/^.*event.*$/) ? "fake_tag" : "**"}>
@type null
</match>
Logic: "If current tag has pattern - set fake_tag for skip this match, else set ** for output all in null"
But this expression doesn't work because there is no variable $tag in ENV. As i understood Ruby expression can't use config variables like ${tag}.
Maybe i can set ENV variable before match step?
Like this:
<filter **event**>
#{ENV["FLUENTD_TAG"] = ${tag}}
</filter>
<match #{FLUENTD_TAG.match(/^.*event.*$/) ? "fake_tag" : "**"}>
@type null
</match>
These are my thoughts but maybe there are simpler ways.
The question is - how to exclude pattern in match ? :-)
Drop 1 and leave everything else:
<match what.you.want.to.drop>
@type null
</match>
<match **>
# process everything else
</match>
Drop everything except one:
<match what.you.want.to.stay>
# process here or send to label
</match>
<match **> # Optional block, it will be dropped anyways if no other matches.
# drop everything else
@type null
</match>