elasticsearch - kubernetes fluentd 如何排除 liveness、readiness/health check 和 fluent.trace?
问题描述
我正在使用最新的 Fluentd /td-agent。如何过滤从 Fluentd 流式传输到 Elasticsearch 的活跃度、就绪性健康检查?我也想排除 fluent.trace。从 Kibana 看到的示例输出:
{
"_index": "aspnetapistarter.logs-2019.07.14",
"_type": "_doc",
"_id": "zFSL72sBodUyUY6Nychc",
"_version": 1,
"_score": null,
"_source": {
"@timestamp": "2019-07-14T08:13:59.1083593+00:00",
"level": "Information",
"messageTemplate": "{HostingRequestStartingLog:l}",
"message": "Request starting HTTP/1.1 GET http://10.1.1.55:5000/health/live ",
"fields": {
"Protocol": "HTTP/1.1",
"Method": "GET",
"ContentType": null,
"ContentLength": null,
"Scheme": "http",
"Host": "10.1.1.55:5000",
"PathBase": "",
"Path": "/health/live",
"QueryString": "",
"HostingRequestStartingLog": "Request starting HTTP/1.1 GET http://10.1.1.55:5000/health/live ",
"EventId": {
"Id": 1
},
"SourceContext": "Microsoft.AspNetCore.Hosting.Internal.WebHost",
"RequestId": "0HLO86B34CTB4:00000001",
"RequestPath": "/health/live",
"CorrelationId": null,
"ConnectionId": "0HLO86B34CTB4"
},
"renderings": {
"HostingRequestStartingLog": [
{
"Format": "l",
"Rendering": "Request starting HTTP/1.1 GET http://10.1.1.55:5000/health/live "
}
]
},
"tag": "aspnetcore"
},
"fields": {
"@timestamp": [
"2019-07-14T08:13:59.108Z"
]
},
"sort": [
1563092039108
]
}
我已经尝试过了,但不起作用:
<filter fluent.*>
@type grep
<exclude>
key tag
pattern fluent.trace
</exclude>
</filter>
<filter aspnetcore-access>
@type grep
<exclude>
key fields.Path
pattern health
</exclude>
</filter>
<filter aspnetcore-access>
@type grep
<exclude>
key fields.RequestPath
pattern health
</exclude>
</filter>
谢谢。WTF 是这样的:“看起来你的帖子主要是代码;请添加更多细节。”
解决方案
确切的语法在这里:
<filter foo.bar>
@type grep
<regexp>
key message
pattern /cool/
</regexp>
<regexp>
key hostname
pattern /^web\d+\.example\.com$/
</regexp>
<exclude>
key message
pattern /uncool/
</exclude>
</filter>
https://docs.fluentd.org/filter/grep
因此,例如,您可以尝试:
<filter aspnetcore-access>
@type grep
<exclude>
key message
pattern /health/
</exclude>
</filter>
推荐阅读
- python - 使用数据类和字典来解决“盒子问题”
- android - 红米 Note 4 中的 ARCORE
- node.js - 如何使用 Chartjs + Nodejs + Express + Api 消耗在服务器端实时生成图表?
- c - char输入而不是int时的C无限循环
- python - IndexError: list out of range for [0] 尝试在 python 中抓取表
- c - Valgrind 和分配/释放内存的简单问题
- reactjs - 如何在 React Native 中的其他对象数组内的对象数组中添加值?
- c# - 如何在非活动类中使用 Xamarin.Firebase.Auth 并获得通知?
- java - Java 10 JavaFX java.lang.IllegalAccessError
- html - 将页脚保持在底部,但不固定