Home/Refreshers/Audit logs nobody can delete: refresher
Audit logs nobody can delete
Send cloud audit logs to storage that refuses deletes for a set number of days.
Remember
- Something changes in the account: every API call is recorded.
- The cloud's audit service: CloudTrail, Activity Log, Cloud Audit Logs, or Audit.
- A delivery pipe: the trail, a diagnostic setting, a sink, or a connector.
- Locked storage: deletes refused until the retention period ends.
| Platform | Uses | The part that catches people |
|---|---|---|
| AWS | CloudTrail writing to S3 with Object Lock turned on | Object Lock can only be switched on at the moment a bucket is created. |
| Azure | Activity Log writing to a blob container with a retention policy | Azure creates the container itself on first delivery, named insights-activity-logs. |
| Google Cloud | A log sink writing to a Cloud Storage bucket with a retention policy | The sink writes as its own service account, which Terraform calls its writer identity. |
| Oracle Cloud | Connector Hub copying audit events to Object Storage with a retention rule | A retention rule cannot lock straight away. |
Run the quick start
| Download providers | terraform init |
| Preview | terraform plan |
| Apply | terraform apply |
| Print the proof commands | terraform output verify |
Watch out
- The copy is only as complete as what the cloud logs in the first place.
- Keep the account or project containing the copy separate from the ones it watches, when you can.
Check it worked
Try to delete a stored log file. The delete should fail. The full page gives the exact commands for each platform.