Amazon ElastiCache
ElastiCache for Memcached User Guide (API Version 2015-02-02)

Logging Amazon ElastiCache API Calls Using AWS CloudTrail

Amazon ElastiCache is integrated with AWS CloudTrail, a service that captures API calls made by or on behalf of ElastiCache in your AWS account and delivers the log files to an Amazon S3 bucket that you specify. CloudTrail captures API calls from the ElastiCache console, the ElastiCache API, or the ElastiCache CLI. Using the information collected by CloudTrail, you can determine what request was made to ElastiCache, the source IP address from which the request was made, who made the request, when it was made, and so on.


CloudTrail does not log runtime calls to your cache or calls to look up data from the cache.

To learn more about CloudTrail, including how to configure and enable it, see the AWS CloudTrail User Guide.

ElastiCache Information in CloudTrail

When CloudTrail logging is enabled in your AWS account, API calls made to ElastiCache actions are tracked in log files. For example, calls to the CreateCacheCluster, DescribeCacheCluster, and ModifyCacheCluster APIs generate entries in the CloudTrail log files. All of the ElastiCache actions are logged. For a full list of ElastiCache actions, see

Each log file contains not only ElastiCache records but also other AWS service records. CloudTrail determines when to create and write to a new log file based on a time period and file size.

Every log entry contains information about who generated the request. The user identity information in the log helps you determine whether the request was made with root or IAM user credentials, with temporary security credentials for a role or federated user, or by another AWS service. For more information, see the documentation for the userIdentity field in the CloudTrail Event Reference.

You can store your log files in your bucket for as long as you want. You can also define Amazon S3 lifecycle rules to archive or delete log files automatically. By default, your log files are encrypted using Amazon S3 server-side encryption (SSE).

If you want to take quick action upon log file delivery, you can have CloudTrail publish Amazon SNS notifications when new log files are delivered. For more information, see Configuring Amazon SNS Notifications.

You can also aggregate ElastiCache log files from multiple AWS regions and multiple AWS accounts into a single Amazon S3 bucket. For more information, see Aggregating CloudTrail Log Files to a Single Amazon S3 Bucket.

Deciphering ElastiCache Log File Entries

CloudTrail log files can contain one or more log entries, where each entry is made up of multiple JSON-formatted events. A log entry represents a single request from any source and includes information about the requested action, any parameters, the date and time of the action, and so on. The log entries are not guaranteed to be in any particular order. That is, they are not an ordered stack trace of the public API calls.

The following example shows a CloudTrail log entry that records a CreateCacheCluster action.

{ "eventVersion":"1.01", "userIdentity":{ "type":"IAMUser", "principalId":"EXAMPLEEXAMPLEEXAMPLE", "arn":"arn:aws:iam::123456789012:user/elasticache-allow", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "userName":"elasticache-allow" }, "eventTime":"2014-12-01T22:00:35Z", "eventSource":"", "eventName":"CreateCacheCluster", "awsRegion":"us-west-2", "sourceIPAddress":"", "userAgent":"Amazon CLI/ElastiCache 1.10 API 2014-12-01", "requestParameters":{ "numCacheNodes":2, "cacheClusterId":"test-memcached", "engine":"memcached", "aZMode":"cross-az", "cacheNodeType":"cache.m1.small" }, "responseElements":{ "engine":"memcached", "clientDownloadLandingPage":"&url-console-domain;elasticache/home#client-download:", "cacheParameterGroup":{ "cacheParameterGroupName":"default.memcached1.4", "cacheNodeIdsToReboot":{ }, "parameterApplyStatus":"in-sync" }, "preferredAvailabilityZone":"Multiple", "numCacheNodes":2, "cacheNodeType":"cache.m1.small", "cacheClusterStatus":"creating", "autoMinorVersionUpgrade":true, "preferredMaintenanceWindow":"thu:05:00-thu:06:00", "cacheClusterId":"test-memcached", "engineVersion":"1.4.14", "cacheSecurityGroups":[ { "status":"active", "cacheSecurityGroupName":"default" } ], "pendingModifiedValues":{ } }, "requestID":"104f30b3-3548-11e4-b7b8-6d79ffe84edd", "eventID":"92762127-7a68-42ce-8787-927d2174cde1" }

The following example shows a CloudTrail log entry that records a DescribeCacheCluster action. Note that for all ElastiCache Describe calls (Describe*), the ResponseElements section is removed and appears as null.

{ "eventVersion":"1.01", "userIdentity":{ "type":"IAMUser", "principalId":"EXAMPLEEXAMPLEEXAMPLE", "arn":"arn:aws:iam::123456789012:user/elasticache-allow", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "userName":"elasticache-allow" }, "eventTime":"2014-12-01T22:01:00Z", "eventSource":"", "eventName":"DescribeCacheClusters", "awsRegion":"us-west-2", "sourceIPAddress":"", "userAgent":"Amazon CLI/ElastiCache 1.10 API 2014-12-01", "requestParameters":{ "showCacheNodeInfo":false, "maxRecords":100 }, "responseElements":null, "requestID":"1f0b5031-3548-11e4-9376-c1d979ba565a", "eventID":"a58572a8-e81b-4100-8e00-1797ed19d172" }

The following example shows a CloudTrail log entry that records a ModifyCacheCluster action.

{ "eventVersion":"1.01", "userIdentity":{ "type":"IAMUser", "principalId":"EXAMPLEEXAMPLEEXAMPLE", "arn":"arn:aws:iam::123456789012:user/elasticache-allow", "accountId":"123456789012", "accessKeyId":"AKIAIOSFODNN7EXAMPLE", "userName":"elasticache-allow" }, "eventTime":"2014-12-01T22:32:21Z", "eventSource":"", "eventName":"ModifyCacheCluster", "awsRegion":"us-west-2", "sourceIPAddress":"", "userAgent":"Amazon CLI/ElastiCache 1.10 API 2014-12-01", "requestParameters":{ "applyImmediately":true, "numCacheNodes":3, "cacheClusterId":"test-memcached" }, "responseElements":{ "engine":"memcached", "clientDownloadLandingPage":"&url-console-domain;elasticache/home#client-download:", "cacheParameterGroup":{ "cacheParameterGroupName":"default.memcached1.4", "cacheNodeIdsToReboot":{ }, "parameterApplyStatus":"in-sync" }, "cacheClusterCreateTime":"Dec 1, 2014 10:16:06 PM", "preferredAvailabilityZone":"Multiple", "numCacheNodes":2, "cacheNodeType":"cache.m1.small", "cacheClusterStatus":"modifying", "autoMinorVersionUpgrade":true, "preferredMaintenanceWindow":"thu:05:00-thu:06:00", "cacheClusterId":"test-memcached", "engineVersion":"1.4.14", "cacheSecurityGroups":[ { "status":"active", "cacheSecurityGroupName":"default" } ], "configurationEndpoint":{ "address":"", "port":11211 }, "pendingModifiedValues":{ "numCacheNodes":3 } }, "requestID":"807f4bc3-354c-11e4-9376-c1d979ba565a", "eventID":"e9163565-376f-4223-96e9-9f50528da645" }