sudo chattr +a /var/log/app.log

Category: Administration

sudo chattr +a /var/log/app.log

Make a log file append-only

The +a flag makes a file append-only, so processes can add lines but nothing can overwrite or delete existing content, not even root. This is ideal for audit logs that must stay tamper-proof. Reverse it with sudo chattr -a.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.