With auditd running, records usually go to /var/log/audit/audit.log. Only privileged users can normally read it. You can read the raw file, but the audit tools are much easier.
One event, several records
A single action produces several lines that share a serial number:
type=SYSCALL msg=audit(1772528042.123:418): syscall=257 success=yes auid=1000 uid=0 comm="vim" exe="/usr/bin/vim.basic" key="identity"
type=PATH msg=audit(1772528042.123:418): item=1 name="/etc/passwd" ...These lines are shortened. In msg=audit(1772528042.123:418), the first number is the time in seconds since 1970 and 418 is the event serial. SYSCALL describes the call and process; PATH names a file involved. Here the user with login UID 1000 acted with UID 0.
Search with ausearch
sudo ausearch -k identity -i
sudo ausearch -ts today -ui 1000 -i
sudo ausearch -m USER_LOGIN -ts recent-k matches the rule's key. -i turns numbers such as user IDs and syscall numbers into names. -ts sets a start time; recent means the last ten minutes. -ui matches a user ID and -m a record type. If nothing matches, you see <no matches>.
Name translation uses the accounts of the machine where you run the command, so take care when reading logs copied from another host.
Summaries with aureport
sudo aureport --summary
sudo aureport -au -i
sudo aureport -k --summaryThe first gives overall counts, the second reports authentication attempts, and the third summarises keys. A summary shows where to look; use ausearch for detail.
Read carefully
success=yes means the system call succeeded, not that the action was approved. success=no may be a harmless permission error or a probe. A watch on writes also records a program that opens the file for writing but changes nothing.
Log size and rotation are set in /etc/audit/auditd.conf, with options such as max_log_file and num_logs. Check them so that old records are not overwritten before you need them.
Try it
On a test VM, create /tmp/audit-demo with touch, add the watch with sudo auditctl -w /tmp/audit-demo -p wa -k demo, then append a line to the file. Run sudo ausearch -k demo -i. Remove the rule with -W and the same arguments. Filtering practice is in the search and archives lab.
Check your understanding
Linux Audit Logs
All 3 sections · no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.