ausearch, aureport

ausearch and aureport are both commands used within the Linux Audit Framework (auditd) to search and generate reports from audit logs. They are essential tools for administrators to analyze and interpret audit data, aiding in security monitoring, incident response, and compliance auditing. Here’s an overview of each command:

1. ausearch

ausearch is used to search and query the audit logs generated by auditd. It allows administrators to filter and retrieve specific audit events based on various criteria such as time range, event type, user identity, and audit key.

Basic Usage

ausearch [options]
  • Options:

    • -c: Filter by specific command executed.

    • -k: Filter by audit key (associated with audit rules).

    • -u: Filter by user identity (UID).

    • -ts: Filter events after a specific timestamp (YYYY-MM-DD HH:MM:SS).

    • -te: Filter events before a specific timestamp (YYYY-MM-DD HH:MM:SS).

    • -f: Filter by file path.

    • -i: Include binary data in output.

    • -m: Filter by message type (e.g., AVC, USER_LOGIN).

Example

  1. Search for File Access Events:

    ausearch -k file_access -i /var/log/messages

    Searches for events related to accessing /var/log/messages with the key file_access.

  2. Search for User Logins:

    ausearch -m USER_LOGIN -ts today

    Searches for login events that occurred today (-ts today).

2. aureport

aureport generates summary reports from the audit logs, providing aggregated statistics and summaries of audit events. It simplifies the process of analyzing audit data by presenting it in a structured and readable format.

Basic Usage

aureport [options]
  • Options:

    • -au: Report on audit usage (per user).

    • -at: Report on audit trail (all events).

    • -ak: Report on audit key (per key).

    • -i: Include binary data in output.

    • -l: List available event types.

    • -f: Filter by file path.

Example

  1. Generate a Summary of Audit Events:

    aureport --summary

    Generates a summary report of all audit events.

  2. Report on User Activity:

    aureport -au

    Generates a report summarizing audit usage per user.

Advanced Usage

  • Integration: Combine ausearch and aureport commands to perform detailed analysis and generate specific reports based on audit log data.

  • Customization: Use filters and options to refine search criteria and tailor reports to specific audit requirements or compliance standards.

Security Considerations

  • Access Control: Ensure audit logs (/var/log/audit/audit.log) are protected from unauthorized access and manipulation.

  • Log Rotation: Manage audit logs effectively to prevent disk space issues and ensure continuous monitoring.

Conclusion

ausearch and aureport are essential tools for administrators leveraging the Linux Audit Framework (auditd) to monitor and analyze system events. By using these commands effectively, administrators can enhance security monitoring, investigate incidents, and maintain compliance with security policies and regulations.

Last updated