Удалить ярлык, чтобы из сферы полномочий на tag_rewrite - PullRequest
1 голос
/ 06 апреля 2020

Я пытаюсь расширить конфигурацию, сделанную кем-то еще на сервере:

#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>

Мое требование - переслать все, не меняя базовую c конфигурацию.

Я попробовал что-то вроде этого, чтобы в основном посылать все из источника в промежуточный LABEL, который затем отправлял все на мою метку резервного копирования, а затем повторял, чтобы <match td-agent.*> (который является точкой входа для гораздо более сложной логики c) может выполнить:

#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>

Но работает только стандартный вывод из резервной копии!

Я подозреваю, что это потому, что мой фиктивный tag_rewrite все еще отправляет данные с прикрепленной меткой? Если так, как я могу удалить это? Если нет, то что мне не хватает?

...