All tags
Start here · logsFind out why a Linux service failed, with journalctl12 steps · 13 min read · Linux server owners who rarely read logsStart the guide logs
Narrow down
Guides1
Shell23
- Tip
script -r demo.recscript -r records a terminal session with timing, and script -p plays it backRecords a terminal session so you can replay it later at its original speed.30 Nov 2026 - Tip
sudo systemd-analyze log-level debugsystemd-analyze log-level debug makes systemd itself log in detailTurn on debug logging for the service manager at runtime, without a reboot.30 Nov 2026 - Tip
grep -E ' (install|upgrade|remove) ' /var/log/dpkg.log | tail/var/log/dpkg.log records every package change, even ones apt did not makeLists each install, upgrade and removal at dpkg level with versions and times.30 Nov 2026 - Tip
[Service]SyslogIdentifier= gives a systemd service a readable name in the logReplace names like sh, python3 or java in log lines with the name of your service.30 Nov 2026 - Tip
sudo journalctl -k --since '10 min ago' | grep 'apparmor="DENIED"'Permission denied with correct permissions often means AppArmor said noFinds AppArmor denials in the kernel log when chmod and chown look right.30 Nov 2026 - Tip
sudo ufw allow log 22/tcpUfw allow log writes every new connection of one rule to the logLogs connections that match one specific rule, without raising the global log level.30 Nov 2026 - Tip
sudo journalctl -k --since '1 hour ago' | grep 'UFW BLOCK'Read a [UFW BLOCK] line by its SRC, DPT and PROTO fieldsExplains the fields in a ufw log line so you can see what was blocked.30 Nov 2026 - Tip
sudo less /var/log/apt/term.log/var/log/apt/term.log keeps the full apt output, error messages includedShows the full terminal output of past apt runs, including install script errors.30 Nov 2026 - Tip
Select-String -Path C:\Temp\app.log -Pattern 'error' -Context 2,3Select-String -Context shows the lines around a matchPrints a few lines before and after every match in a text file.28 Nov 2026 - Tip
grep -n -C 3 'segfault' /var/log/sysloggrep -C 3 shows the lines around each matchShows a few lines before and after every match, so you see what led up to an error.27 Nov 2026 - Tip
grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' /var/log/auth.loggrep -o prints only the part of the line that matchedPrints only the matched text, like IP addresses, instead of the whole log line.27 Nov 2026 - Tip
sudo logrotate -d /etc/logrotate.d/myappLogrotate -d shows what a rotation would do without touching a fileTest a logrotate config and see what it would rotate, without changing any log.27 Nov 2026 - Tip
sudo systemctl edit myapp.serviceLogFilterPatterns= drops a service's noisy lines before journalctl stores themStop a service's repetitive log lines from being stored in the journal at all.27 Nov 2026 - Tip
sudo systemctl edit myapp.serviceStandardOutput=append: writes a systemd service's output to a plain log fileSends a service's output to a normal text log file instead of the journal.27 Nov 2026 - Tip
journalctl JOB=nightly-backupLogExtraFields= adds your own field to a service's log lines for journalctlTags the log lines of several services with one field so you can read them together.27 Nov 2026 - Tip
sudo auditctl -a always,exit -F arch=b64 -F path=/etc/passwd -F perm=wa -k passwd-changeAn auditd rule logs who changed /etc/passwd, even after a sudoLogs every change to an important file together with the user who logged in.27 Nov 2026 - Tip
systemd-cat -t backup /usr/local/bin/backup.shsystemd-cat sends a script's output to the systemd journal under its own nameLogs the output of a script or command to the journal with a tag and priority you choose.26 Nov 2026 - Tip
diagnosticsRun diagnostics in the terminal when the WebGUI will not loadCreates a support zip of your Unraid system from the terminal and saves it to the boot device.5 Jul 2026 - Tip
journalctl --disk-usagejournalctl --vacuum-size caps how much log space you keepShrinks the systemd journal to a size you pick by deleting the oldest logs.16 Jun 2026 - Tip
sudo fail2ban-regex /var/log/auth.log sshdfail2ban-regex tests a jail filter on a real log, a security habitChecks how many log lines a fail2ban filter matches before any ban is created.22 May 2026 - Tip
sudo ufw logging mediumUfw logging medium decides how much the firewall writes downSets how many firewall events ufw writes to its log file.10 May 2026 - Tip
tail -f /var/log/syslog | grep --line-buffered ERROR | cut -c1-100Grep --line-buffered keeps a terminal pipe from stallingMakes grep print each match immediately when it feeds another command.20 Apr 2026 - Tip
sudo dmesg --level=err,warnDmesg --level=err,warn filters the linux kernel log by severityShows only kernel errors and warnings instead of the whole ring buffer.10 Apr 2026
Other tips18
- Tip
lastlog --before 90lastlog --before finds accounts that have not logged in latelyList accounts that have not logged in for a number of days3 Dec 2026 - Tip
rotate 4Olddir in logrotate moves rotated logs into a folder of their ownKeeps all rotated copies of a log in one separate directory instead of next to the live file.3 Dec 2026 - Tip
sort -m app.log worker.log | lesssort -m merges several logs into one timelineRead events from two files in the order they happened.1 Dec 2026 - Tip
sed -E 's/[0-9]+/N/g' app.log | sort | uniq -c | sort -rn | head -n 15Mask the numbers in logs and uniq -c finds the message that repeats mostCollapse near identical lines to see which message dominates a file.1 Dec 2026 - Tip
awk '$1 >= "2026-11-30T02:00" && $1 < "2026-11-30T03:00"' app.logawk can cut a time window out of logs that use ISO timestampsExtract only the lines between two moments from a large file.1 Dec 2026 - Tip
rotate 14Delaycompress leaves the newest rotated logs uncompressed for one roundKeep yesterday's file readable and avoid compressing a file still in use.1 Dec 2026 - Tip
ps -o pid,lstart,etime,cmd -p 1234ps -o lstart,etime shows when a process started and how long it ranCheck whether a service really restarted after your change or crashed recently.1 Dec 2026 - Tip
MariaDB [shop]> tee /tmp/fix-orders.logTee in the mariadb client logs your whole database session to a fileRecords every query and result of an interactive session in a log file.30 Nov 2026 - Tip
truncate -s 0 /var/log/app/debug.logtruncate -s 0 empties a log file that a program still has openFree the space of a runaway log without deleting the file or restarting the program.30 Nov 2026 - Tip
last -x shutdown reboot | headlast -x shows whether a Linux server shut down cleanly or just went darkSee the reboots and shutdowns of a machine, so you can tell a crash from a planned restart.30 Nov 2026 - Tip
Get-Content -Path C:\Logs\app.log -Tail 20 -WaitGet-Content -Tail 20 -Wait follows a log file in PowerShell like tail -fShows the last lines of a file and keeps printing new ones as they are written.28 Nov 2026 - Tip
rotate 4Copytruncate rotates a log for programs that never let go of the fileRotate the log of a program that keeps its log file open and can't reopen it.27 Nov 2026 - Tip
rotate 14Dateext puts the date in rotated log names instead of a numberName rotated log files after their date, so you find the right day at once.27 Nov 2026 - Tip
rotate 4The su line in logrotate fixes "parent directory has insecure permissions"Let logrotate rotate logs in a folder that a normal user or app can write to.27 Nov 2026 - Tip
zgrep -i 'out of memory' /var/log/syslog*zgrep searches rotated .gz logs without unpacking themSearches compressed and plain log files with one grep command, no unpacking needed.27 Nov 2026 - Tip
less /var/log/apt/history.log/var/log/apt/history.log shows what apt installed and whenShows which packages apt installed, upgraded or removed, on which date and by which command.27 Nov 2026 - Tip
Get-WinEvent -FilterHashtable @{LogName='System'; Level=1,2; StartTime=(Get-Date).AddDays(-1)}Get-WinEvent -FilterHashtable shows only the errors from the last dayPulls only recent critical and error events from a Windows log, without opening Event Viewer.26 Nov 2026 - Tip
less +F /var/log/syslogless +F follows a file like tail -f and lets you scroll backFollows a growing log file, and lets you stop and scroll back through it.19 Nov 2026
Docker7
- Tip
docker exec -it --user www-data nextcloud php occ log:watchOcc log:watch follows the Nextcloud log live in your terminalShows new log entries while you reproduce a problem.1 Dec 2026 - Tip
docker logs myapp 2>&1 | grep -i errorPipe docker logs with 2>&1 or grep misses half the linesMake grep see the error lines a container writes to stderr.30 Nov 2026 - Tip
docker run -d --log-driver local --name web nginx:alpineThe local log driver keeps Docker logs compressed and rotated by defaultSwitch to Docker's local log driver for smaller logs that rotate on their own.30 Nov 2026 - Tip
docker compose logs --no-log-prefix --no-color --tail 100 appdocker compose logs --no-log-prefix prints plain log linesPrints compose logs without the service-name prefix, so the lines can be copied cleanly.28 Nov 2026 - Tip
docker run -d --log-opt max-size=10m --log-opt max-file=3 <image>–log-opt max-size and max-file stop a container log from growing foreverRotates a container's json-file log by size and keeps a fixed number of old files.28 Nov 2026 - Tip
docker logs --since 10m -f container-namedocker logs --since 10m -f shows only what just happenedShows only the last few minutes of a container's log and follows new lines.17 Nov 2026 - Tip
docker logs --timestamps --tail 1000 --since 30m mycontainerSet timestamps and a time range in the portainer log view instead of scrollingUses the display options of the container log page to find a specific time or message.9 Mar 2026
Network4
- Tip
less /var/log/nginx/error.log& in less hides every line that does not match in the terminal pagerFilters a log inside less without quitting and running grep.30 Nov 2026 - Tip
tail -F /var/log/nginx/access.logtail -F keeps following a log after logrotate renames itFollows a log file by name so it keeps working after the file is rotated.8 Oct 2026 - Tip
access_log /var/log/nginx/access.log combined if=$loggable;Nginx access_log with if= keeps health checks out of the logSkips chosen requests, such as health checks, when writing the access log.4 May 2026 - Tip
log_format timed '$remote_addr "$request" $status $body_bytes_sent 'Nginx log_format with $request_time shows which requests are slowAdds request and upstream timing to each access log line.4 May 2026
Storage4
- Tip
logger -t backup "nightly sync finished"logger -t lets a script write its own lines to the system logWrites a tagged message from a script to the system log so you can find it later.28 Nov 2026 - Tip
maxsize 100Mmaxsize makes logrotate rotate a log early when it grows too fastRotate a log on its normal schedule and also as soon as it passes a size.27 Nov 2026 - Tip
Remote syslog server: the IP address of this serverPoint the syslog server at the server itself to keep logs on a shareKeeps a lasting copy of the Unraid system log on a share instead of on the boot drive.19 Jul 2026 - Tip
Settings > Syslog Server > Mirror syslog to boot drive: YesMirror the syslog to the boot drive, but only for a few daysKeeps the system log across a crash by writing it to the boot drive while it happens.13 Jul 2026
Home Assistant2
- Tip
logger:The logger integration sets one default log level and a louder one for a single integrationLowers the Home Assistant log level for everything and raises it for one integration.28 Nov 2026 - Tip
Settings > Devices & services > (integration) > Menu > Enable debug loggingEnable debug logging on one integration, and Home Assistant switches it off after two restartsTurns on debug logs for one integration from the interface and downloads them when you turn it off.28 Nov 2026
Mac1
Media1
Git1
Nothing matches.