是否可以将日志流放入 CloudWatch 指标过滤器中?
我想创建一个 CloudWatch 指标过滤器,以便计算包含错误行的日志条目数
Connection State changed to LOST
我有一个名为“nifi-app.log”的 CloudWatch 日志组,其中包含 3 个日志流(每个名为“i-xxxxxxxxxxx”的 EC2 实例一个) ,'i-yyyyyyyyyy'等)
理想情况下,我想提取一个带有维度InstanceId
的指标nifi_connection_state_lost_count
其中该值是日志流名称。
根据我从 文档,可以从日志文件内容本身提取维度,但我没有看到任何方法来引用日志流名称。
日志条目看起来像这样
2022-03-15 09:44:47,811 INFO [Curator-ConnectionStateManager-0] o.a.n.c.l.e.CuratorLeaderElectionManager org.apache.nifi.controller.leader.election.CuratorLeaderElectionManager$ElectionListener@3fe60bf7 Connection State changed to LOST
我知道我可以使用 [date,level,xxx,yy,zz]
从该日志条目中提取字段,但我需要的不是日志条目本身,它是日志条目的一部分日志条目元数据(日志流名称)。
日志文件是 NiFi 日志文件,没有实例名称、主机名或每个日志行中打印的类似内容,我不想尝试更改日志格式,因为它需要重新启动 NiFi 集群,我什至不知道如何更改它。
那么,是否可以通过其他方式获取日志流名称作为 CW 指标过滤器的维度?
I want to create a CloudWatch metric filter so that I count the number of log entries containing the error line
Connection State changed to LOST
I have CloudWatch Log Group called "nifi-app.log" with 3 log streams (one for each EC2 instance named `i-xxxxxxxxxxx', 'i-yyyyyyyyyy', etc)
Ideally I would want to extract a metric nifi_connection_state_lost_count
with a dimension InstanceId
where the value is the log stream name.
From what I gather from the documentation, it is possible to extract dimension from the log file contents themselves but I do not see any way to refer to the log stream name for example.
The log entries look like this
2022-03-15 09:44:47,811 INFO [Curator-ConnectionStateManager-0] o.a.n.c.l.e.CuratorLeaderElectionManager org.apache.nifi.controller.leader.election.CuratorLeaderElectionManager$ElectionListener@3fe60bf7 Connection State changed to LOST
I know that I can extract fields from that log entries with [date,level,xxx,yy,zz]
but what I need is not in the log entry itself, it's part of the log entry metadata (the log stream name).
The log files are NiFi log files and do NOT have the instance name, hostname, or anything like that printed in each log line, and I would rather not try to change the log format as it would require a restart of the NiFi cluster and I'm not even sure how to change it.
So, is it possible to get the log stream name as dimension for a CW metric filter in some other way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论