问题描述
我是Fluentd的新手.关于<match>
标记及其格式,我有一个问题.例如
I'm new to Fluentd. I have one problem regarding the <match>
tag and its format. For example
- 我们的系统在同一标签:标签 上返回两种不同的格式: format1 和 format2
- 使用fluent.conf,我们可以捕获提供的标签,但无法将这两种格式分开
我尝试了 fluent-plugin-multi-format-parser 但不允许我添加前缀.
I tried the fluent-plugin-multi-format-parser but it does not allow me to add the prefixes.
<match tag>
@type parser
format multi
<pattern>
format format1
add_prefix pattern1
...
</pattern>
<pattern>
format format2
add_prefix pattern2
...
</pattern>
</match>
对此有任何解决方法吗?
Is there any work-around solution for this?
推荐答案
我认为此Google网上论坛对话有一个解决方案:
I think the answer in this Google Groups conversation has a solution:
具体来说(以防链接无效并为那些不太感兴趣的人节省时间):
Specifically (incase the link doesn't work and to save time for those less interested):
出于您的目的,您可以使用copy
插件.复制整个邮件,然后像这样进行过滤:
For your purpose, you can use copy
plugin. Copy the entire message, and then filter like:
<match tag>
type copy
<store>
type grep
input_key format_type
regexp pattern1
add_tag_prefix pattern1
</store>
<store>
type grep
input_key format_type
regexp pattern2
add_tag_prefix pattern2
</store>
</match>
<match pattern1.tag>
</match>
<match pattern2.tag>
</match>
input_key
必须是运行正则表达式的关键.
The input_key
needs to be the key to run the regexp against.
这篇关于流利的:一场比赛中有多种格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!