tips
9 tips Logs
One command, setting or habit at a time about Logs: what it does, the line to copy and a caveat or two.
Logs and diagnostics 6
-
Keeps all rotated copies of a log in one separate directory instead of next to the live file.
rotate 4 -
Read events from two files in the order they happened.
sort -m app.log worker.log | less -
Collapse near identical lines to see which message dominates a file.
sed -E 's/[0-9]+/N/g' app.log | sort | uniq -c | sort -rn | head -n 15 -
Extract only the lines between two moments from a large file.
awk '$1 >= "2026-11-30T02:00" && $1 < "2026-11-30T03:00"' app.log -
Keep yesterday's file readable and avoid compressing a file still in use.
rotate 14 -
Searches compressed and plain log files with one grep command, no unpacking needed.
zgrep -i 'out of memory' /var/log/syslog*
Apps and containers 2
-
Lowers the Home Assistant log level for everything and raises it for one integration.
logger: -
Keeps a lasting copy of the Unraid system log on a share instead of on the boot drive.
Remote syslog server: the IP address of this server
Hardening 1
-
Logs every change to an important file together with the user who logged in.
sudo auditctl -a always,exit -F arch=b64 -F path=/etc/passwd -F perm=wa -k passwd-change
Nothing in this filter yet.