Searching and Analyzing Audit Logs
What you'll learn: How to efficiently query and analyze Linux audit logs using ausearch and aureport to investigate security events and generate compliance reports.
The Challenge of Raw Audit Data
Now that you've configured auditd to capture events, you face a new problem: audit logs are extremely verbose and stored in a binary format. Reading /var/log/audit/audit.log directly is overwhelming—imagine searching through thousands of cryptic entries to find one failed login attempt. You need specialized tools to make sense of this data.
Using ausearch for Targeted Queries
ausearch lets you search audit logs with specific filters, like asking a librarian to find books by a particular author rather than browsing every shelf:
Filter by event type:
ausearch -m USER_LOGIN
Filter by user:
ausearch -ua username
Filter by time range:
ausearch -ts today -te now
ausearch -ts 10:00 -te 11:00
Filter by success/failure:
ausearch -m USER_AUTH -sv no # failed authentication
Using aureport for Summary Reports
While ausearch shows individual events, aureport generates statistical summaries—think of it as the audit log's "executive summary":
Authentication summary:
aureport -au
Failed events report:
aureport -f
File access summary:
aureport -f
User activity report:
aureport -u
Combining Tools for Investigation
You often start with aureport to spot anomalies, then use ausearch to investigate details. For example, if aureport -au shows unusual login attempts, you'd drill down with ausearch -m USER_AUTH -sv no to examine each failure.
Key Takeaway: ausearch provides filtered, detailed audit event searches by time, user, and event type, while aureport generates summary statistics—together they transform raw audit data into actionable security intelligence for investigations and compliance reporting.