Software & OS

Log Files in Linux: Where They Are and How to Read Them

On a modern Linux system, logs live in two places: the systemd journal, which you read with journalctl, and plain text files under /var/log. To see the latest system messages, run sudo journalctl -e; to follow a text log live, run sudo tail -f /var/log/syslog on Ubuntu or sudo tail -f /var/log/messages on RHEL, Fedora and similar.

The journal and /var/log: how they fit together

Most distributions now use systemd. Its logging service, systemd-journald, collects messages from the kernel, from services and from programs, and stores them in a binary journal. On many systems a second service, rsyslog, receives the same messages and writes them out as text files in /var/log, sorted by type. Red Hat's documentation describes exactly this chain: journald collects and forwards, and rsyslog "sorts syslog messages by type and priority and writes them to the files in the /var/log directory".

Which one you have depends on the distribution:

DistributionJournalMain text logLogin and sudo log
Ubuntu 22.04Yes/var/log/syslog/var/log/auth.log
Debian 12 and later (new installs)YesNone by default (rsyslog not installed)Use journalctl
RHEL, Rocky, AlmaYes/var/log/messages/var/log/secure

The Debian 12 release notes state that "From bookworm, rsyslog is no longer installed by default", and suggest journalctl -e and journalctl -ef as the replacements for reading and following /var/log/syslog.

What's in /var/log

This is the listing from an Ubuntu 22.04 system, with rotated copies trimmed:

$ ls /var/log
alternatives.log  apt  auth.log  bootstrap.log  btmp  dist-upgrade  dmesg
dpkg.log  faillog  installer  journal  kern.log  lastlog  private  syslog
ubuntu-advantage.log  unattended-upgrades  wtmp
FileWhat it holds
syslog (Debian/Ubuntu) or messages (RHEL)General system messages from most services
auth.log or secureLogins, SSH, sudo use, authentication failures
kern.logKernel messages (drivers, disks, out-of-memory kills)
dpkg.log, apt/Package installs, upgrades and removals on Debian and Ubuntu
cron, maillog, boot.log (RHEL)Scheduled jobs, mail server, system startup
wtmp, btmp, lastlogBinary login records. Read them with last, lastb and lastlog, not a text viewer.
journal/The persistent systemd journal (binary; read with journalctl)
Subfolders named after an applicationLogs that an application writes itself

Which message lands in which file is set by rsyslog rules. On Ubuntu 22.04 they are in /etc/rsyslog.d/50-default.conf:

auth,authpriv.*                 /var/log/auth.log
*.*;auth,authpriv.none          -/var/log/syslog
kern.*                          -/var/log/kern.log
mail.*                          -/var/log/mail.log

The left side is the facility and priority; *.*;auth,authpriv.none means "everything except authentication messages", which is why login events appear in auth.log and not in syslog.

Files such as syslog.1 and syslog.2.gz are older, rotated copies. On that Ubuntu system, /etc/logrotate.d/rsyslog rotates the files weekly, keeps 4 old copies and compresses them. Read compressed ones with zless or zgrep.

Most of these files are readable only by root and the adm group. On Ubuntu they are owned syslog:adm with mode -rw-r-----, so a normal user gets "Permission denied" without sudo.

Reading the journal with journalctl

These cover most real troubleshooting:

CommandShows
journalctl -eJumps to the newest entries in the pager
journalctl -fFollows new entries as they arrive, like tail -f
journalctl -n 50The last 50 lines
journalctl -u nginxOnly one service (systemd unit)
journalctl -bOnly the current boot; -b -1 is the previous boot
journalctl -p err -bErrors and worse from this boot
journalctl --since "1 hour ago"A time window; also --since "2026-11-18 09:00" --until "2026-11-18 10:00"
journalctl -kKernel messages only (like dmesg)
journalctl -rNewest first
journalctl -o json-prettyEvery field of each entry, for scripts

Options combine. To see why a service failed to start on the previous boot: sudo journalctl -u myapp -b -1 -p warning. The priority levels run from emerg (0) to debug (7), and -p err includes everything from err up. To manage the service itself, see systemctl commands.

Two lines of example output from journalctl --no-pager on Ubuntu 22.04 (host and user names replaced):

Oct 26 19:34:07 host systemd[1]: Startup finished in 2.490s.
Oct 26 19:34:07 host login[354]: pam_unix(login:session): session opened for user alex(uid=1000) by (uid=0)

Each line shows the time, the host, the program with its process ID in brackets, and the message.

Who can read the journal

Any user can read their own messages. The full system journal is open to root and to members of the systemd-journal, adm and wheel groups. If journalctl prints far fewer lines than you expect, rerun it with sudo.

Is the journal kept across reboots?

The Storage= setting in /etc/systemd/journald.conf decides. persistent keeps the journal on disk under /var/log/journal; volatile keeps it in memory under /run/log/journal, so it is lost at shutdown; auto behaves like persistent if /var/log/journal exists and like volatile otherwise. Defaults vary by systemd version and distribution: the current man page gives persistent, while Ubuntu 22.04 (systemd 249) ships with the line #Storage=auto. The quick test is journalctl --list-boots: if it lists earlier boots, logs survive reboots.

By default the journal may use up to 10% of the file system, capped at 4 GB. Check with journalctl --disk-usage; on the Ubuntu system above it reported Archived and active journals take up 736.0M in the file system.

Searching text logs

sudo grep -i "error" /var/log/syslog
sudo zgrep "Failed password" /var/log/auth.log*
sudo tail -n 100 /var/log/syslog
sudo less +F /var/log/syslog

The second command searches current and compressed rotated logs in one go, which is useful when the event happened last week. In less +F, press Ctrl+C to stop following and scroll, then F to resume. For more search patterns, see grep command examples.

Where application logs go

A service run by systemd usually logs to the journal through its standard output, so journalctl -u name is the first place to look. Many server applications, such as web servers and databases, also write their own files, usually in a subfolder of /var/log. The application's config file names the exact path. Docker containers are separate again: docker logs container-name shows what the container wrote to its output.

If a log you expect is empty, check that the program is actually running, that it has write permission on the folder, and whether it logs to the journal instead of a file.

Frequently asked questions

Why is /var/log/syslog missing?
Your system probably doesn't run rsyslog, the service that writes that file. Since Debian 12, rsyslog is no longer installed by default, and RHEL-family systems name the main file /var/log/messages instead. On any systemd system, journalctl shows the same messages.
Why does journalctl only show my own messages?
Reading the system journal needs root or membership in a group such as systemd-journal, adm or wheel. Run the command with sudo, or ask an administrator to add your account to the systemd-journal group.
How do I free disk space used by logs?
Check the journal with journalctl --disk-usage, then shrink it with sudo journalctl --vacuum-size=500M or --vacuum-time=2weeks, which delete the oldest archived journal files. For text logs, rotated files ending in .1 or .gz in /var/log can be deleted; never delete or truncate a log that a service still has open without understanding the effect.
Are logs kept after a reboot?
Text files in /var/log are. The systemd journal is kept only if it is stored on disk under /var/log/journal; if it is stored under /run/log/journal it is in memory and lost at reboot. Run journalctl --list-boots: more than one boot listed means the journal is persistent.

Sources