Collect, index, and visualize audit logs for analysis and investigation.
AWS Console → OpenSearch Service → Create domain.
Select Deployment type: Development and testing.
Set Domain name: audit-trail-demo
.
Set capacity: 1 instance, type c7g.xlarge.search
.
Network configuration:
AuditDemo-VPC
AuditDemo-PublicSubnet
(Go to Route tables -> Edit subnet associations -> select both Subnets -> click Save)AuditDemo-SG
Access policy (allow Lambda and you to access):
{ “Version”: “2012-10-17”, “Statement”: [ { “Effect”: “Allow”, “Principal”: { “AWS”: [ “arn:aws:iam::<ACCOUNT_ID>:role/AuditLoggerLambdaRole”, “arn:aws:iam::<ACCOUNT_ID>:user/” ] }, “Action”: “es:”, “Resource”: “arn:aws:es::<ACCOUNT_ID>:domain/audit-trail-demo/” } ] }
Click Create domain and wait for the status to become Active.
I tried but still don’t know how to create the domain correctly.
AuditStream
(or Direct PUT if not using buffer).audit-trail-demo
→ enter Index name audit-logs
.Step 1 must be completed.
FirehoseDeliveryRole
with es:ESHttpPost
and s3:PutObject
permissions (if backup is enabled).audit-demo-backup
.Open OpenSearch Dashboards from the link in the OpenSearch Console.
Go to Stack Management → Index Patterns → Create index pattern:
audit-logs*
timestamp
or @timestamp
) to filter by time.Visualize Library → Create visualization:
Dashboard → Create dashboard Audit Trail Dashboard
→ Add the visualizations you just created.
Send some test events via Lambda (step 2) to generate logs.
Wait a few minutes, Firehose will push data to OpenSearch.
Discover: on Dashboards, go to the Discover tab to view raw logs.
Dashboard: open Audit Trail Dashboard
, check:
action
.Completing all steps will display the results.