我正在尝试扩展其他人在服务器上进行的配置:
#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>
我的要求是将所有内容转发出去,而无需更改很多基本配置。
我尝试了类似的方法,基本上将所有内容从源发送到中间的LABEL,然后将所有内容发送到我的Backup标签,然后进行汇款,以使<match td-agent.*>
(这是更多内容的入口点)复杂的逻辑)可以执行:
#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仍在发送带有标签的数据吗?如果是这样,我如何将其删除?如果没有,我想念什么?