CloudTrail logs provide critical ground truth auditing of all AWS activity. Whether malicious or otherwise, timely detection of CloudTrail logging becoming disabled is important. Use this procedure to detect and alert when CloudTrail logs have been disabled.
AWS: CloudTrail logs
- Configure the Splunk Add-on for Amazon Web Services.
- Ensure that your deployment is ingesting AWS data through one of the following methods:
- Pulling the data from Splunk via AWS APIs. At small scale, pull via the AWS APIs will work fine.
- Pushing the data from AWS into Splunk via Lambda/Firehose to Splunk HTTP event collector. As the size and scale of either your AWS accounts or the amount of data to be collected grows, pushing data from AWS into Splunk is the easier and more scalable method.
- Run the following search:
index="<AWS index name>" sourcetype="aws:cloudtrail" eventName=StopLogging | rename requestParameters.name AS trail_name userIdentity.arn AS who_done_it | table _time aws_account_id region eventName trail_name who_done_it
The table provides an explanation of what each part of this search achieves. You can adjust this query based on the specifics of your environment.
|index="<AWS index name>" sourcetype="aws:cloudtrail"||Search the index(s) where AWS data is stored filtered to just the AWS CloudTrail data.|
|eventName=StopLogging||Filter the results down to the StopLogging event which is emitted when Cloudtrail logging is disabled.|
|| rename requestParameters.name AS trail_name userIdentity.arn AS who_done_it||Rename the fields as shown for better readability.|
|| table _time aws_account_id region eventName trail_name who_done_it||Display the results in a table with columns in the order shown.|
Use the results of this search to re-enable CloudTrail logging and to take the appropriate measures to address the account that disabled it.
You might also be interested in other processes associated with the Managing an Amazon Web Services environment use case.