最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Cloudwatch log insight for showing prev week and current week count as well as diff - Stack Overflow

programmeradmin3浏览0评论

I need to imitate the sumologic dashboard to cloudwatch. I need a widget showing the count of transactions for this week against previous week and the difference in hourly manner. Is it possible to do this in cloudwatch?

What I tried:

fields @timestamp, @message
| parse @message /com\.xxx\.x\confirmation (?<json>.*)/ 
| fields jsonParse(json) as parsedJson
| filter parsedJson.bookingStatus = "SUCCESS"
| stats sum(if(toMillis(@timestamp) >= now() - 604800000, count(parsedJson.pnr), 0)) as current_week_count,
        sum(if((toMillis(@timestamp) >= now() - 1209600000 and @timestamp < now() - 604800000, count(parsedJson.pnr), 0)) as previous_week_count
| sort @timestamp desc
| display current_week_count, previous_week_count, current_week_count - previous_week_count as difference

Issue: Type Mismatch

Also tried a few functions which didn't work.diff (compare on) gives me the difference but im struggling to get the current and prev week count in same widget along with diff.

发布评论

评论列表(0)

  1. 暂无评论