Amazon Mobile Analytics
User Guide

Part 8: Configure CloudWatch


After April 30, 2018, Amazon Mobile Analytics features will be provided only by Amazon Pinpoint. If you're new to Mobile Analytics, use Amazon Pinpoint instead. If you're currently using Mobile Analytics, see Migrating from Amazon Mobile Analytics to Amazon Pinpoint.

Configure Amazon CloudWatch to monitor the event loader command.

Create an Agent Configuration File

The following example shows how to create an agent configuration file on the Amazon EC2 instance using Nano:

$ nano /tmp/cwlogs/application.conf

Add the following to the configuration file:

[general] state_file = /var/awslogs/agent-state [application.log] file = /home/ec2-user/DataExport/logs/application.log* log_group_name = MobileAnalytics.application.log log_stream_name = {instance_id}/application.log datetime_format = %a %b %d %H:%M:%S %Y

Start the CloudWatch Agent

Start the CloudWatch agent with this command:

$ sudo python / -n -r us-east-1 -c /tmp/cwlogs/application.conf

Here is an example of the output:

						Example command line output from starting CloudWatch

Logs appear in the CloudWatch console after each run of the loadevents scripts.

						Logs in CloudWatch console after each run of loadevents scripts

Create a Metric Filter to Detect Errors

Next, you must create a CloudWatch metric filter to catch errors.

  1. Navigate to the CloudWatch console and choose Logs.

  2. Choose the MobileAnalytics.application.log.

  3. Choose Create Metric Filter.

  4. Choose ERROR as the filter pattern.

  5. Type a name for the Metric Namespace; for example, MobileAnalytics.

  6. Type the name of the Metric; for example, ApplicationLogError.

  7. For Metric Value, type 1.

  8. Choose Create Filter.

								Select assign metric