Leverage AWS CloudWatch Insights to gain real-time troubleshooting, pattern identification, and valuable insights into contact flows through log data analysis.
Amazon Connect is a cloud-based contact center solution that provides businesses with a simple and scalable way to manage customer interactions. With Amazon Connect, companies can set up a customizable contact center that integrates with their existing systems and processes, allowing them to provide high-quality customer service.
Amazon Connect generates data Contact Flow logs stored in Amazon Connect log groups. The log streams provide detailed information about the call journey. However, it becomes challenging for contact centers with large call volumes to navigate and analyze standard log data in Amazon CloudWatch log streams.
AWS CloudWatch Insights is a fully managed service that allows you to search and analyze log data using a query language. You can use CloudWatch Insights to troubleshoot issues, identify patterns, and find solutions to problems in near real time. CloudWatch Insights uses a simple yet powerful query language that allows you to filter, aggregate, and group log data to gain insights into your contact flows.
To use CloudWatch Insights to analyze contact flow logs, you must first enable logging for your Amazon Connect instance and add Set logging behavior to the contact flows. Once logging is enabled, CloudWatch Insights will automatically start receiving and storing contact flow logs.
You can use CloudWatch Insights to answer questions like:
Go to the CloudWatch Console home page, and click on the Logs Insights menu under Logs.
From the CloudWatch Insights page, select the log group(s) you want to run queries against.
For Amazon Connect, you can query Amazon Connect Instance logs or streaming data (Kinesis Stream) from Connect. This article will show sample queries against instance logs and streaming logs.
For Contact Flow Logs, you’ll choose your Connect Instance.
Select the data and specify the date range you want to run the query.
This query is the default, which appears when you first load the page. It shows the logs in descending order and is limited to the last 20 log messages. The syntax commands start with the “|” (pipe character) at the beginning of the line. You may comment using “#” at the front of the line, which your query will ignore.
fields @timestamp, @message
| sort @timestamp desc
| limit 20
Result
This query will return all Contact Flow Logs for the specified Contact Id displayed in order by timestamp
fields @timestamp, @message
| sort @timestamp desc
| filter ContactId = "{contactid}"
| display Results, ContactId, @timestamp, ContactFlowModuleType
Result
The query will return the number of calls that generated some logging. This query will not necessarily return the number of calls to your Connect Instance, only those where logging is enabled.
fields @timestamp, @message
| sort @timestamp
| stats count_distinct(ContactId)
Result
This query will return all logs for a specific Lambda Function. You can see the Parameters sent to the Lambda Function, and the return results for each invocation logged.
fields @timestamp, @message
| sort @timestamp
| filter ContactFlowModuleType = "InvokeExternalResource"
| filter Parameters.FunctionArn = "{lambda-arn}"
The query will return the results showing a number of log events in the log group that CloudWatch Logs received every 30 seconds.
fields @timestamp, @message
| sort @timestamp
| stats count_distinct(ContactId) by bin(15m)
Choose the Visualization tab. The results are shown as a graph. To switch to a bar chart, pie chart, or stacked area chart, choose the arrow next to the Pie at the upper left of the graph.
You can enable Data Streaming which generates Contact Trace Records (CTRs) and Agent Events to perform real-time analysis on contacts. Data Streaming sends data to Amazon Kinesis. You can create Lambda functions that read data from the Kinesis stream and analyze the logs from the Lambda function.
From the dropdown, choose your lambda function, which triggers kinesis stream data.
This query will return distinct calls disconnected by the customer within the selected duration.
fields @timestamp, @message
| stats latest(@timestamp) as @latestTimestamp by @message
| filter DisconnectReason = "CUSTOMER_DISCONNECT"
| sort @timestamp
This query shows to select specific fields instead of fetching all fields.
fields @timestamp, @message
| filter DisconnectReason = "CUSTOMER_DISCONNECT"
| sort @timestamp
| stats count_distinct (ContactId) by bin(60m), ContactId, Queue.Duration, CustomerEndpoint.Address, InitiationMethod, Queue.Name
This query will return Abandoned calls within the selected duration.
fields @timestamp, @message
| filter Agent = "None"
| filter DisconnectReason = "CUSTOMER_DISCONNECT"
| filter ispresent (Queue.Name) and Queue.Name != "None"
| filter InitiationMethod = "INBOUND"
| filter Queue.Duration > 0
| sort @timestamp
| stats count_distinct (ContactId) by bin(60m), Queue.Duration, ContactId, CustomerEndpoint.Address, InitiationMethod, Queue.Name,Queue.EnqueueTimestamp
After you create a query, you can save it and rerun it later. You can organize the queries in folders by category or service.
To save a query :
To run a saved query :
CloudWatch Insights is a powerful tool that provides businesses with detailed insights into their contact center operations, allowing them to monitor and optimize their operations in real time and make informed decisions.
Whether you need advice or are ready to get started, we're here to help. We go the extra mile to empower your digital transformation.