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 in 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)
Open the CloudTrail console at https://console.amazonaws.cn/cloudtrail/
. -
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.
-
In the left-hand navigation pane, choose Event history.
-
Choose Filter criteria and/or a Time range to help you find the event that you're looking for. For example:
-
To see all Secrets Manager events, for Lookup attributes, choose Event source. Then, for Enter event source, choose
secretsmanager.amazonaws.com
. -
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.
-
-
To see additional details, choose the expand arrow next to the 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