Understanding /var/log/messages in Linux
Learn what /var/log/messages contains, how to read and monitor it, how it differs from /var/log/syslog and the systemd journal, and how to use it for troubleshooting.
/var/log/messages is a general-purpose system log found on many Linux systems that use traditional syslog-style logging. It can contain messages from services, the kernel, hardware, networking components, and other parts of the operating system.
It is not a universal or complete record of every event. The logging daemon, distribution, configuration rules, installed services, and incident itself determine which log is most useful. Depending on the system, the relevant information may instead be in /var/log/syslog, the systemd journal, a service-specific log, or a security log.
What /var/log/messages contains
On traditional syslog-based distributions, a syslog daemon receives messages and routes them to destinations according to configuration rules. One destination may be /var/log/messages.
Common event types include:
- Service and daemon startup, shutdown, and status messages
- Kernel-related notices and warnings
- Boot and shutdown activity
- Hardware detection and device events
- Network interface changes, link events, and DHCP activity
- Authentication-adjacent system notices, such as a service rejecting or accepting a connection
- Errors, warnings, and other diagnostic messages
The exact contents are controlled by the logging configuration. A distribution may use rsyslog, syslog-ng, systemd-journald, or a combination of these. A service may also write to its own log or only to the journal.
Use the log that matches the incident. For example, a kernel hardware problem may require the journal or dmesg, an SSH problem may be clearer in the SSH service journal, and an application failure may be recorded only by that application.
Which systems have this file?
/var/log/messages is common on RHEL-family, Fedora-family, SUSE-family, and other systems configured to write general syslog messages to that filename. Debian- and Ubuntu-style systems commonly use /var/log/syslog for a comparable general-purpose text log.
Some modern installations rely primarily on systemd-journald. They may not create either text file by default. Always check before trying to read a path:
ls -l /var/log/messages /var/log/syslog 2>/dev/nullReading the log safely
When maintained by a syslog daemon, the file is normally plain text. It can become large, so use a pager rather than opening it in an editor or printing the whole file to the terminal.
sudo less /var/log/messagesInside less, use the arrow keys or Page Up and Page Down to navigate, /term to search, and q to quit. Elevated privileges may be required because log files often have restricted ownership and permissions. Use sudo only when authorized; do not weaken permissions globally just to make logs easier to read.
To inspect recent entries:
sudo tail /var/log/messages
sudo tail -n 50 /var/log/messagesTo monitor new entries while reproducing a problem:
sudo tail -F /var/log/messages-F follows the filename and is generally better than plain -f when log rotation can rename the current file and create a replacement. Behavior still depends on the rotation method and the tool. If messages do not appear, compare the text file with journalctl -f.
Search case-insensitively for several terms:
sudo grep -i 'dhcp\|network\|error' /var/log/messagesFor more practice with text searching, see searching for text with grep.
Anatomy of a traditional syslog entry
A traditional entry often resembles this fictional example:
Aug 18 14:22:07 host-a dhclient[842]: eth0: DHCPREQUEST for 192.0.2.42Traditional timestamps may omit the year and timezone. A PID may be missing, and applications may place their own structured fields in the message body. The program name and PID help identify the source process. The hostname becomes especially valuable when messages are forwarded from several machines into one central log.
Example: interpreting a DHCP client event
In the example, dhclient is the DHCP client, 842 is its process ID, and eth0 is the network interface. A DHCP lease is a temporary address assignment from a DHCP server. A request or renewal message indicates that the client is maintaining or attempting to maintain that assignment.
A lease renewal is often normal network maintenance, not automatically an error. To decide whether it is a problem, inspect nearby entries and the service context. Look for an acknowledgment, an address change, repeated retries, timeouts, link-down events, or a later failure. Informational messages, warnings, and failures must be interpreted together rather than by one alarming-looking word.
A practical troubleshooting workflow
- Identify approximately when the problem occurred. Record the local time, timezone, host, and affected service or interface.
- Inspect entries immediately before and after that time. The initiating event may precede the visible symptom.
- Search for the affected service, device, interface name, username, error text, or relevant keyword.
- Correlate the result with the journal, a service-specific log, kernel messages, authentication logs, or logs from another host.
- Verify the current state instead of assuming that a log message describes the present condition. For example, check a service with
systemctl statusor inspect a network interface with the appropriate network command. - Preserve the timestamp and a small surrounding context when escalating the issue. Redact sensitive values before sharing it.
A log entry is evidence, not automatically the root cause. A service may report the symptom of a lower-level network, storage, permission, or dependency problem. Correlation across sources and verification of the current state are essential.
/var/log/messages and the systemd journal
systemd-journald collects structured journal records from the kernel, services, standard output, and other sources on many modern Linux systems. The records can contain metadata that is not visible in a traditional text line, such as the systemd unit, boot identifier, priority, and process information.
rsyslog or syslog-ng may receive selected messages from syslog sources or the journal, filter them by facility and priority, and write them to files such as /var/log/messages or /var/log/syslog. Consequently, the text file may be a subset of the journal, and the journal may be the better source when the file is missing or incomplete.
sudo journalctl -n 50
sudo journalctl -f
sudo journalctl -b
sudo journalctl -b -1
sudo journalctl -u sshd --since '1 hour ago'These commands show recent records, follow new records, display the current boot, display the previous boot, and filter by a systemd unit and time range. Journal queries can also filter by boot, unit, priority, and time. If the expected text log does not exist, start with journalctl rather than creating a new file manually.
Log rotation and retention
Logs are rotated to prevent uncontrolled disk usage. A rotation policy may rename the active file, create a new file, compress older files, and remove data after a defined retention period.
Common names include:
messages.1for a recent uncompressed rotated filemessages-20260818for a date-based rotated filemessages.2.gzfor an older compressed file
sudo ls -lh /var/log/messages*
sudo zless /var/log/messages.2.gzzless lets you inspect a gzip-compressed log without manually extracting it. Retention periods, rotation frequency, compression, and file naming are controlled by the administrator and distribution configuration. Older evidence may therefore no longer be available.
Logging configuration
rsyslog is a widely used syslog implementation that receives, filters, stores, and forwards messages. syslog-ng is an alternative implementation with similar collection and routing responsibilities. Both commonly use syslog facilities and priorities.
A facility identifies the source category, such as kernel, mail, or daemon. A priority identifies severity, ranging from emergency through debug. Configuration rules combine these properties with destinations. A rule might route selected daemon and kernel messages to /var/log/messages, while sending authentication-related messages elsewhere.
Common rsyslog locations include /etc/rsyslog.conf and files under /etc/rsyslog.d/. Inspect rules that reference the file with:
sudo grep -R --line-number '/var/log/messages' /etc/rsyslog.conf /etc/rsyslog.d 2>/dev/null
systemctl status rsyslogPaths for syslog-ng and other logging services vary by distribution. Log rotation rules are commonly found in /etc/logrotate.conf and /etc/logrotate.d/:
sudo grep -R --line-number 'messages' /etc/logrotate.conf /etc/logrotate.d 2>/dev/nullSecurity and operational considerations
Logs may contain hostnames, IP addresses, service names, usernames, interface names, and other operational details. Limit access according to local policy. Before sharing an excerpt, redact addresses, usernames, tokens, internal hostnames, and other sensitive values while retaining useful timestamps and message context.
If expected messages stop appearing, check:
- Available disk space and inode availability
- Filesystem errors or a read-only filesystem
- The status and health of rsyslog, syslog-ng, or journald
- Whether the service writes to a different log or only to the journal
- Whether rotation changed the active filename
- Whether the journal is persistent or only stored in volatile memory
Accurate clocks matter when correlating events between systems. Verify time synchronization and timezone assumptions; a clock adjustment can make an event appear earlier or later than expected. See Network Time Protocol and NTP for related timekeeping concepts.
Common problems and diagnostic paths
/var/log/messages does not exist
- Check whether
/var/log/syslogexists. - Query recent entries with
sudo journalctl -n 50. - Check the status of the installed logging service.
- Review configuration before creating or altering a destination.
New events are not appearing
- Compare
sudo tail -F /var/log/messageswithsudo journalctl -f. - Check logging service status and disk space.
- Review rotation activity and confirm that you are following the active filename.
- Check whether the relevant service uses its own log.
An error line has no clear cause
- Inspect a time window before and after the line.
- Filter by the program name and PID when available.
- Check the associated systemd unit and service-specific logs.
- Correlate with kernel, network, authentication, or application events.
Expected entries are missing after a reboot
- Use
journalctl --list-bootsand query the relevant boot. - Inspect rotated files such as
messages.1and compressed archives. - Check whether the journal was persistent or volatile.
- Account for clock changes and time synchronization.
Reading the log returns permission denied
- Inspect file permissions and ownership.
- Use
sudowhere authorized. - Check distribution-specific journal-reading groups and mandatory access policies.
- Do not weaken log permissions globally as a shortcut.
Exam-relevant notes
/var/log/messagesis a general text log on many traditional syslog configurations, not a guaranteed path on every Linux distribution.- Debian and Ubuntu commonly use
/var/log/syslogfor comparable general system messages. journalctlis the primary query tool for systemd journal records.tail -Fis useful for following a text log through common rotations.- Facilities classify message sources; priorities classify severity.
- Log rotation controls disk use and retention, so historical evidence may be compressed or deleted.
- A single log line is evidence that must be correlated with surrounding events, service state, and other logs.
For broader Linux administration topics, return to the Linux topic index. Related skills include determining file types, managing file ownership, and understanding UID and GID permissions.