如何告诉Fluentd根据“ Logger_name”过滤日志过滤日志。场地?
我的代码会发出结构化日志,其中包含logger_name
字段。这些日志后来通过fluentd
发送到某些远程日志记录存储。我希望Fluentd过滤来自Kafka Streams库的日志。尝试了这种配置,但它不起作用:
<filter containers.**>
@type grep
<exclude>
key logger_name
pattern /org.apache.kafka.streams/
</exclude>
</filter>
我正在使用logback
和afaik,它负责添加logger_name
字段,所以我认为可以肯定地假设当Fluentd
看到日志时,它们已经包含此字段。
过滤器不起作用的原因是什么?
My code issues structured logs, which contain a logger_name
field. These logs are later sent to some remote logging storage via fluentd
. I'd like fluentd to filter logs coming from Kafka streams library. Tried this configuration, but it did not work:
<filter containers.**>
@type grep
<exclude>
key logger_name
pattern /org.apache.kafka.streams/
</exclude>
</filter>
I'm using logback
, and AFAIK, it's in charge of adding the logger_name
field, so I think it's safe to assume that when fluentd
sees the logs, they already contain this field.
What could be the reason the filter is not working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题不是在语法中,而是在模式字段中:
。
应逃脱,制作正确的模式:添加缺失的
\
后,该过滤器用作预期的。The issue was not in the syntax, but rather in the pattern field:
The
.
should be escaped, making the correct pattern:After adding the missing
\
, the filter worked as expected.