Log Amazon Secrets Manager events with Amazon CloudTrail - Amazon Secrets Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Log Amazon Secrets Manager events with Amazon CloudTrail

Amazon CloudTrail records all API calls for Secrets Manager as events, including calls from the Secrets Manager console, as well as several other events for rotation and secret version deletion. For a list of the log entries Secrets Manager records, see CloudTrail entries.

You can use the CloudTrail console to view the last 90 days of recorded events. For an ongoing record of events in your Amazon account, including events for Secrets Manager, create a trail so that CloudTrail delivers log files to an Amazon S3 bucket. See Creating a trail for your Amazon account. You can also configure CloudTrail to receive CloudTrail log files from multiple Amazon Web Services accounts and Amazon Web Services Regions.

You can configure other Amazon services to further analyze and act upon the data collected in CloudTrail logs. See Amazon service integrations with CloudTrail logs. You can also get notifications when CloudTrail publishes new log files to your Amazon S3 bucket. See Configuring Amazon SNS notifications for CloudTrail.

To retrieve Secrets Manager events from CloudTrail logs (console)
  1. Open the CloudTrail console at https://console.amazonaws.cn/cloudtrail/.

  2. Ensure that the console points to the region where your events occurred. The console shows only those events that occurred in the selected region. Choose the region from the drop-down list in the upper-right corner of the console.

  3. In the left-hand navigation pane, choose Event history.

  4. Choose Filter criteria and/or a Time range to help you find the event that you're looking for. For example:

    1. To see all Secrets Manager events, for Lookup attributes, choose Event source. Then, for Enter event source, choose secretsmanager.amazonaws.com.

    2. To see all events for a secret, for Lookup attributes, choose Resource name. Then, for Enter a resource name, enter the name of the secret.

  5. To see additional details, choose the expand arrow next to event. To see all of the information available, choose View event.

Amazon CLI

Example Retrieve Secrets Manager events from CloudTrail logs

The following lookup-events example looks up Secrets Manager events.

aws cloudtrail lookup-events \ --region us-east-1 \ --lookup-attributes AttributeKey=EventSource,AttributeValue=secretsmanager.amazonaws.com