Home > Enterprise >  How can I find the missed utterances rate per day from Lex using CloudWatch?
How can I find the missed utterances rate per day from Lex using CloudWatch?

Time:10-14

We want to find the missed utterance rate per day from Lex logs.

For example:

  • Day 1 - 10 total utterances, 1 missed utterance
  • Day 2 - 20 total utterances, 4 missed utterance
  • ...

We want to be able to plot (missed utterances/total utterances x 100) per day (essentially, %) for one week, however we also need to include Lambda exceptions as part of our "missed utterances" count.

How do we calculate the total & missed utterance count and then obtain a %?

Is this possible in CloudWatch Insight Logs?

Expectd output is a graph for 7 days that has the percentage of missed utterances exceptions to total utterances for the day.

  1. <date 1> 1%
  2. <date 2> 4%
  3. ...

One query we tried is:

 fields @message
| filter @message like /Exception/ or missedUtterance=1
| stats count(*) as exceptionCount, count(@message) as messageCount by bin(1d)
| display exceptionCount, (exceptionCount/messageCount) * 100
| sort @timestamp desc

CodePudding user response:

This is unfortunately not possible to do within CloudWatch Log Insights as you would need to have 2 filter & 2 stats commands.

One filter would be used for getting the total count & another for getting the exception missed utterance count.

While you can filter after one another, you can't get the counts of the result of each filter as 2 stats commands are not supported from within Log Insights (yet).

The most you can do within CloudWatch is to create a dashboard (or 2 Log Insights) with the below queries and calculate the percentage yourself:

fields @message
| stats count(*) as totalUtteranceCount by bin(1d)
fields @message
| filter @message like /Exception/ or missedUtterance = 1
| stats count(*) as exceptionAndMissedUtteranceCount by bin(1d)

In an enterprise chatbot project that I was an engineer on, I configured logs to be exported to ElasticSearch (enter image description here

  • Related