1

I am trying to generate a graph that will display the success/failure rate of an operation. In my application I am pushing log events in the following format: [loggingType] loggingMessage.
I want to create a pie chart that shows the ratio of success/failure but its not working. I am running the following:

filter @logStream="RunLogs"
 | parse @message "[*] *" as loggingType, loggingMessage
 | filter loggingType in ["pass","fail"]
 | stats count(loggingType="pass")/count(loggingType="fail") as ratio by bin(12w)

It seems like the condition inside count does not work and grabs everything. It returns 1 every time :(

Sina
  • 11
  • 2

1 Answers1

0

I came across a similar scenario; but, super weirdly I believe, if you change the query to use sum instead of count it works. Not sure why AWS query execution interprets in this way.

filter @logStream="RunLogs"
| parse @message "[*] *" as loggingType, loggingMessage
| filter loggingType in ["pass","fail"]
| stats sum(loggingType="pass")/sum(loggingType="fail") as ratio by bin(12w)
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Jeb
  • 11
  • 1