Cloudwatch 见解,按 JSON 值的值查询图表?
我的日志中有一个JSON对象,显示为以下内容:
"result":{
"totalRecords":8,
"bot":3,
"member":5,
"message":0,
"reaction":0,
"success":0,
"error":0,
"unknown":8
}
我正在尝试编写一个日志见解查询来绘制每个键的值。从本质上讲,我想要一个具有不同行的线图,以适应每个键的值。目前,我的查询如下:
fields result.bot, result.error, result.member, result.message, result.reaction,
result.success, result.totalRecords, result.unknown
| stats count(result.bot), count(result.error),
count(result.member),count(result.message),
count(result.reaction),count(result.success),
count(result.totalRecords), count(result.unknown) by bin(30s)
这返回了键在日志中显示多少次的数量,但没有值。
我需要知道的是您用来获取给定键的值。我尝试在.0
附加附加,例如count(result.totalrecords.0)
,如AWS文档中建议的,但不会返回任何值。钥匙值的查询是什么?
I've got a JSON object in my logs that shows up as the following:
"result":{
"totalRecords":8,
"bot":3,
"member":5,
"message":0,
"reaction":0,
"success":0,
"error":0,
"unknown":8
}
I'm trying to write a logs insights query to graph the values of each of those keys. Essentially I want a line chart with a different line for the value of each of the keys. Currently I have my query as the following:
fields result.bot, result.error, result.member, result.message, result.reaction,
result.success, result.totalRecords, result.unknown
| stats count(result.bot), count(result.error),
count(result.member),count(result.message),
count(result.reaction),count(result.success),
count(result.totalRecords), count(result.unknown) by bin(30s)
This returns the count of how many times the keys show up in the logs, but not the values.
What I need to know is what you use to get the value of a given key. I tried appending a .0
for example count(result.totalRecords.0)
as was suggested in the AWS docs but it doesn't return any value. What is the query for the value of a key?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于文档
您可以代替
等等。这将为您提供30秒内的这些值的总和。如果您想要更大的粒度,则可以缩短时期。
Based on documentation
You can write instead
etc. This will give you sum of those values over 30s periods. You can shorten the period if you want greater granularity.