Remove label so from remit on tag_rewrite

Viewed 158

I'm trying to extend the configuration someone else made on a server:

#input from collectd over http
<source>
   type http
   port 26001
   bind 127.0.0.1
</source>

# This actually does other stuff, just changed to file for debugging
# I cannot change anything here on the final result
<match td-agent.*>
    @type file
    path /var/log/fluent/myapp2
    compress gzip
    <buffer>
      timekey 1d
      timekey_use_utc true
      timekey_wait 1m
    </buffer>
</match>

My requirement is to forward everything out, without changing a lot the basic configuration.

I tried something like this, to basically send everything from the source to an intermediate LABEL, that then send everything to my Backup label, and then remits so that the <match td-agent.*> (which is the entry point for much more complex logic) can execute:

#input from collectd over http
<source>
   type http
   port 26001
   bind 127.0.0.1
   @label @MULTIPLEX # Added This label
</source>

# This label is meant to simply copy everything to BACKUP, and then remit so that original match rule can run
<label @MULTIPLEX>
  <match **>
    @type copy
    <store>
      @type relabel
      @label @BACKUP
    </store>

    # Dummy rule that simply copies everything again
    <store>
      @type rewrite_tag_filter
      <rule>
        key plugin
        pattern /.*/
        tag ${tag}
      </rule>
    </store>
  </match>
</label>

# This will actually forward everything out
<label @BACKUP>
  <match **>
    @type file
    path /var/log/fluent/myapp
    compress gzip
    <buffer>
      timekey 1d
      timekey_use_utc true
      timekey_wait 1m
    </buffer>
  </match>
</label>

# This Actually does other stuff, just changed to file for debugging
<match td-agent.*>
    @type file
    path /var/log/fluent/myapp2
    compress gzip
    <buffer>
      timekey 1d
      timekey_use_utc true
      timekey_wait 1m
    </buffer>
</match>

But only the stdout from backup is working!

I suspect this is because my dummy tag_rewrite is still sending the data with the label attached? If so, how can I remove it? If not, what am I missing?

0 Answers
Related