<p>I want to output all in null, except the one pattern in <strong>match</strong>. I know there are some ways to do that via @labels for example, but i exactly want to exclude pattern in <strong>match</strong>. </p>

<p>I want to do like this:</p>

<pre><code>&lt;match {all tags except **events**}&gt;
</code></pre>

<p><strong>What i did:</strong></p>

<p>I know i can use Ruby expressions in <strong>match</strong> like this:</p>

<pre><code>&lt;match #{tag.match(/^.*event.*$/) ? "fake_tag" : "**"}&gt;
  @type null
&lt;/match&gt;
</code></pre>

<p><strong>Logic:</strong> "If current tag has pattern - set fake_tag for skip this <strong>match</strong>, else set ** for output all in null"</p>

<p>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}.</p>

<p>Maybe i can set ENV variable before <strong>match</strong> step? </p>

<p>Like this:</p>

<pre><code>&lt;filter **event**&gt;
  #{ENV["FLUENTD_TAG"] = ${tag}}
&lt;/filter&gt;

&lt;match #{FLUENTD_TAG.match(/^.*event.*$/) ? "fake_tag" : "**"}&gt;
  @type null
&lt;/match&gt;
</code></pre>

<p>These are my thoughts but maybe there are simpler ways.</p>

<p>The question is - how to exclude pattern in <strong>match</strong> ? :-) </p>

<p>Drop one, leave everything else:</p>
<pre><code>&lt;match what.you.want.to.drop&gt;
  @type null
&lt;/match&gt;
&lt;match **&gt;
  # process everything else
&lt;/match&gt;
</code></pre>
<p>Drop everything except one:</p>
<pre><code>&lt;match what.you.want.to.stay&gt;
  # process here or send to a label
&lt;/match&gt;
&lt;match **&gt; # Optional block. It will be dropped anyways if no other matches, but with a warning printed to a fluentd log.
  # Drop everything else explicitly to avoid warning.
  @type null
&lt;/match&gt;
</code></pre>
