<p>Is there a way to exclude certain namespaces in <code>fluent-bit</code>? I would like to exclude certain namespaces, so that <code>fluent-bit</code> doesn't forward all logs created in those namespaces to ELK.</p>
<p>Is there a way to do it besides adding annotation to each pod in that namespace? I'm aware that you can update all of the pods annotations in a namespace via kubectl.</p>
<blockquote>
<p>kubectl annotate pods --namespace=pks-system --all fluentbit.io/exclude='true'</p>
</blockquote>

<p>I think the following input plugin configuration can do this:</p>
<pre><code> [INPUT]
        Name              tail
        Path              /var/log/containers/*.log
        Exclude_Path      /var/log/containers/*_&lt;myappnamespace&gt;_*.log,/var/log/containers/*_&lt;myappnamespace2&gt;_*.log
        Tag               kube.infra.&lt;namespace_name&gt;.&lt;pod_name&gt;.&lt;container_name&gt;
        Tag_Regex         (?&lt;pod_name&gt;[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?&lt;namespace_name&gt;[^_]+)_(?&lt;container_name&gt;.+)-
        Parser            cri
        DB                /var/log/flb_kube_infra.db
        Mem_Buf_Limit     500KB
        Skip_Long_Lines   On
        Refresh_Interval  10
</code></pre>
<p>Found it here: <a href="https://github.com/fluent/fluent-bit/issues/758" rel="nofollow noreferrer">https://github.com/fluent/fluent-bit/issues/758</a></p>
<p>The <code>Exclude_Path</code> property defines the name of the namespace for which logs will be ignored. For multiple logs use comma separated</p>
