标签的子集到第二个输出
Subset of tag to a second output
我有一项服务正在尝试记录日志并将它们发送到特定位置,具体取决于它们所指的内容。 Fluentd 是有道理的。目前,我只是把所有东西都扔给了 s3,而且工作正常。但是,我现在想要将一小部分(以短语 "ACTION:" 开头的任何行)也发送到 mongo 数据库。我仍然希望将所有内容发送到 s3。
我这里有这个配置文件,当然不能用
<source>
@type forward
@id input
@label mainstream
port 24224
</source>
<label @mainstream>
<match foo.**>
@type copy
<store>
@type s3
...
</store>
<store>
@type rewrite_tag_filter
rewriterule1 log "^ACTION:" foo.bar
</store>
</match>
<match foo.bar>
@type mongo
...
</matc>
</label>
一旦我们到达第一个匹配标签,所有内容都会被收集并停止,rewrite_tag_filter
的正常行为似乎不会传递到 <store>
之后。
我尝试过的其他东西。
- 复制 s3
store
所以它被使用了两次。但是我不希望我的 s3 输出被拆分。
- 在不同的端口转发给自己,运行源通过不同的标签,但是它不会连接。
我确定我问的不是太疯狂。有人做过这样的事吗?
只是需要注意重新标记的内容。如果你使用的东西会被上面的匹配匹配,它就不会继续,所以它需要不同。在这种情况下,即使标签不同,因为我是从 foo
开始的,它也不会超过 <match foo.**>
.
<source>
@type forward
@id input
@label mainstream
port 24224
</source>
<label @mainstream>
<match foo.**>
@type copy
<store>
@type s3
...
</store>
<store>
@type rewrite_tag_filter
# Changed tag from foo.bar to this
rewriterule1 log "^ACTION:" totally.different.tag.name
</store>
</match>
# the new totally.different.tag.name won't get caught by the
# first <match foo.**> so it will actually reach this one
<match totally.different.tag.name>
@type mongo
...
</match>
</label>
我有一项服务正在尝试记录日志并将它们发送到特定位置,具体取决于它们所指的内容。 Fluentd 是有道理的。目前,我只是把所有东西都扔给了 s3,而且工作正常。但是,我现在想要将一小部分(以短语 "ACTION:" 开头的任何行)也发送到 mongo 数据库。我仍然希望将所有内容发送到 s3。
我这里有这个配置文件,当然不能用
<source>
@type forward
@id input
@label mainstream
port 24224
</source>
<label @mainstream>
<match foo.**>
@type copy
<store>
@type s3
...
</store>
<store>
@type rewrite_tag_filter
rewriterule1 log "^ACTION:" foo.bar
</store>
</match>
<match foo.bar>
@type mongo
...
</matc>
</label>
一旦我们到达第一个匹配标签,所有内容都会被收集并停止,rewrite_tag_filter
的正常行为似乎不会传递到 <store>
之后。
我尝试过的其他东西。
- 复制 s3
store
所以它被使用了两次。但是我不希望我的 s3 输出被拆分。 - 在不同的端口转发给自己,运行源通过不同的标签,但是它不会连接。
我确定我问的不是太疯狂。有人做过这样的事吗?
只是需要注意重新标记的内容。如果你使用的东西会被上面的匹配匹配,它就不会继续,所以它需要不同。在这种情况下,即使标签不同,因为我是从 foo
开始的,它也不会超过 <match foo.**>
.
<source>
@type forward
@id input
@label mainstream
port 24224
</source>
<label @mainstream>
<match foo.**>
@type copy
<store>
@type s3
...
</store>
<store>
@type rewrite_tag_filter
# Changed tag from foo.bar to this
rewriterule1 log "^ACTION:" totally.different.tag.name
</store>
</match>
# the new totally.different.tag.name won't get caught by the
# first <match foo.**> so it will actually reach this one
<match totally.different.tag.name>
@type mongo
...
</match>
</label>