|
| 1 | +.TH AUDITD.CRON "5" "Feb 2025" "Red Hat" "System Administration Utilities" |
| 2 | +.SH NAME |
| 3 | +auditd.conf \- time-based rotation of audit logs |
| 4 | +.SH DESCRIPTION |
| 5 | +By default, the audit daemon (auditd) supports size-based log rotation, where logs are rotated once they reach a specified size, as configured in |
| 6 | +.I /etc/audit/auditd.conf. |
| 7 | +This manual describes an alternative method: time-based log rotation using |
| 8 | +.B cron. |
| 9 | +Using this approach, audit logs can be rotated at specified intervals (hourly, daily, weekly or on a custom date), regardless of their size. |
| 10 | + |
| 11 | +.SH CONFIGURATION |
| 12 | + |
| 13 | +.B 1.Disable Size-Based Rotation: |
| 14 | + |
| 15 | +To enable time-based log rotation, first disable \fBauditd's\fP built-in size-based rotation by setting the following parameter in |
| 16 | +.I /etc/audit/auditd.conf: |
| 17 | + |
| 18 | +.RS |
| 19 | +max_log_file_action = ignore |
| 20 | +.RE |
| 21 | + |
| 22 | +.B 2. Configure Log Retention: |
| 23 | + |
| 24 | +The |
| 25 | +.B num_logs |
| 26 | +parameter determines the number of rotated log files to keep. For daily rotation, setting |
| 27 | + |
| 28 | +.RS |
| 29 | +num_logs = 7 |
| 30 | +.RE |
| 31 | + |
| 32 | +ensures that logs from the last seven days are retained. However, on busy systems, audit logs may grow rapidly, potentially leading to a lack of disk space. To prevent this, ensure that the |
| 33 | +.B space_left_action |
| 34 | +parameter is configured to handle low-disk-space situations appropriately. |
| 35 | + |
| 36 | +.B 3. Apply Configuration Changes: |
| 37 | + |
| 38 | +After modifying the main auditd configuration file, reload auditd to apply the changes: |
| 39 | + |
| 40 | +.RS |
| 41 | +auditctl --signal reload |
| 42 | +.RE |
| 43 | + |
| 44 | +.B 4. Deploy the Rotation Script: |
| 45 | + |
| 46 | +Copy the provided |
| 47 | +.B auditd.cron |
| 48 | +script to the appropriate cron directory ( |
| 49 | +.IR cron.daily |
| 50 | +or |
| 51 | +.IR cron.hourly |
| 52 | +or |
| 53 | +.IR cron.weekly |
| 54 | +, depending on your rotation preference). Then, ensure the file has the correct SELinux labels: |
| 55 | + |
| 56 | +.RS |
| 57 | +cp /usr/share/doc/audit/auditd.cron /etc/cron.daily |
| 58 | +.RE |
| 59 | + |
| 60 | +.SH "SEE ALSO" |
| 61 | +.BR auditd.conf (5), |
| 62 | +.BR auditd (8), |
| 63 | +.BR cron(8). |
| 64 | + |
| 65 | +.SH AUTHOR |
| 66 | +Attila Lakatos |
0 commit comments