Logs

The CloudWatch log groups that we will be interacting with today were automatically created by Container Insights when it was configured. They are appear in the console with the following syntax:

  • /aws/ecs/containerinsights/<CLUSTER_NAME>/performance

The application log groups appear with this syntax:

  • /ecs/<ClusterName>
  1. In the AWS Management Console on the Services menu, click CloudWatch.
  2. In the left navigation menu under Logs, click on Log groups.
  3. In the Filter log groups search bar, type in Services-PayForAdoption.

ECS Metrics

  1. Click on the log group that is returned in the results by clicking on the name.

This will take you to a page that shows you the different log streams within the log group.

  1. Select the log stream that begins with ClusterTelemetry by clicking on the log stream name.

This is the log group that contains performance metrics at the cluster level. To see data collected at the ECS Service level, select the log stream that begins with FargateTelemetry.

  1. Type CloudWatchMetrics (case sensitive) into the Filter events search box.

  2. Click on an arrow from the first column in the table to expand a log.

Along with the performance log data, you will also see that there are metrics present in Embedded Metric Format.

Visit the Embedded Metric Format (EMF) module if you would like to learn more about EMF.

Your screen should look similar to the screen shot below. From here you can view and analyze the metric log data.

ECS Metrics

Using Logs Insights to query log data

CloudWatch Logs Insights supports a query language that you can use to perform queries on your log groups.

Visit the Logs Insights module for a deeper dive on this topic.

  1. In the left navigation menu under Logs, click on Insights.
  2. Click the select log group(s) search/drop down and type Services-PayForAdoption.
  3. Select the log group returned in the results by checking the checkbox.
  4. Delete the query that is already in the query editor and copy and paste in the following query:
fields @timestamp, @message
| filter @message like 'In CompleteAdoption'
| sort @timestamp desc
| limit 20
  1. Click run query.

Running the query above returns log data that contains the string In ComleteAdoption in the log message.

Your screen should look similar to the screenshot shown below.

EKS LogInsightsQuery

This concludes this section. You may continue on to the next section.