[英]AWS CloudWatch Logs Insights
I am working with data that comes in similar format to this in insights.我正在处理与见解格式类似的数据。 Sometimes the value of J may be missing and I want to set the value as the value of B if this is the case.
有时 J 的值可能会丢失,如果是这种情况,我想将该值设置为 B 的值。 Is there any way to do conditional logic similar to this on data in CloudWatch Insights?
有没有办法对 CloudWatch Insights 中的数据执行与此类似的条件逻辑? I have explored
ispresent()
but cannot figure out how to do the conditional logic.我已经探索了
ispresent()
但无法弄清楚如何执行条件逻辑。
Example:例子:
B![]() |
J ![]() |
---|---|
1 ![]() |
3 ![]() |
2 ![]() |
4 ![]() |
2 ![]() |
for the last I would like to set the data equal in J to 2 when I run the query.最后,我想在运行查询时将 J 中的数据设置为 2。
You may be able to use coalesce(J, B)
which won't set the J to 2 but can be assigned to a new field (eg fields coalesce(J, B) as newB
that can be used for display or additional logic. coalesce
takes 2+ arguments and returns the first value that isn't blank.您可以使用
coalesce(J, B)
,它不会将J 设置为2,但可以分配给新字段(例如, fields coalesce(J, B) as newB
可用于显示或附加逻辑的fields coalesce(J, B) as newB
。 coalesce
接受 2+ 个参数并返回第一个不为空的值。
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html (search for coalesce) https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html (搜索coalesce)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.