As a Linux user, have you ever wondered where your system logs all of its activities? Or wanted to look back through historical events on your machine? Syslog is the answer!
Syslog provides a comprehensive record of everything happening under the hood in Linux. Understanding where syslog files are stored allows you to unlock this incredibly useful trove of system information.
In this in-depth guide, we‘ll explore the key locations where Linux stores syslog files on major distributions. You‘ll also learn how to access and leverage these critical logs for security, troubleshooting, and more!
What is Syslog in Linux?
According to the syslog standard, the syslog protocol allows applications and system services to send event notification messages to a centralized logging server or daemon. This syslog daemon then aggregates and stores log data in files on the Linux system.
Here are some key concepts that make up a syslog implementation in Linux:
The Syslog Daemon
The syslog daemon is the central server that collects log messages and writes them to files. Most Linux distributions run either rsyslog or syslog-ng as the syslog daemon:
- rsyslog – The default syslog daemon on many distros like Debian, Ubuntu, CentOS, etc. Rsyslog supports TCP protocols for remote log collection.
- syslog-ng – An enhanced syslog daemon used on some systems like RHEL, Arch, Gentoo, etc. Syslog-ng adds features like filtering, message manipulation, and complex routing.
According to experts, rsyslog is sufficient for most logging needs. But syslog-ng offers greater flexibility for complex enterprise deployments.
Facilities
Syslog messages contain a facility value indicating the type of system component that generated the event. Some common facilities include:
| Facility | Description |
|---|---|
| kern | Linux kernel |
| user | User processes/applications |
| Mail system | |
| daemon | Background system daemons |
| auth | Authentication/security programs |
Priorities
Syslog messages have a priority value denoting the severity of the event:
| Priority | Description |
|---|---|
| emerg | Emergency – system unstable |
| alert | Action required immediately |
| crit | Critical error condition |
| err | General error messages |
| warn | Warning messages |
| notice | Normal but significant events |
| info | Informational messages |
| debug | Debugging messages |
Log Files
The syslog daemon writes messages to log files stored at standard locations on the filesystem. We‘ll cover common log file locations in the next section.
With these syslog concepts in mind, let‘s look at where Linux actually stores the log files on your systems!
Where Does Syslog Store Log Files in Linux?
While specific locations may vary slightly across distributions, here are some of the most common directories where syslog log files reside in Linux:
1. /var/log/syslog
The /var/log/syslog file is the primary and default syslog log location on most Linux distributions like Ubuntu, Debian, SUSE, etc.
This main syslog file contains global system-level messages from across the Linux kernel, services, and applications. Checking /var/log/syslog provides a chronological audit trail of all activities on your system.
According to experts, syslog should be the first location to consult when troubleshooting Linux issues. It offers an overview of what‘s happening on the machine.
Here‘s a sample of messages in /var/log/syslog on an Ubuntu system:
Mar 5 12:02:11 ubuntu CRON[1458]: pam_unix(cron:session): session closed for user root
Mar 5 12:17:01 ubuntu CRON[1496]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar 5 12:22:09 ubuntu kernel: [22192.168561] usb 1-3: new high-speed USB device number 5 using xhci_hcd
Mar 5 14:07:01 ubuntu CRON[2045]: pam_unix(cron:session): session closed for user root
As you can see, this covers cron jobs, USB devices, authentication events, and more.
2. /var/log/auth.log
The /var/log/auth.log file records critical system authorization and authentication events. This includes:
- User login attempts and sessions
- SSH connections
sudocommands- Password changes
Monitoring auth.log provides an audit trail for compliance and security forensics. For example, you can see failed login attempts indicating a brute force attack:
Mar 5 12:15:26 ubuntu sshd[1943]: Failed password for invalid user admin from 192.168.0.14 port 50158 ssh2
Mar 5 12:15:51 ubuntu sshd[1943]: Failed password for root from 192.168.0.14 port 50158 ssh2
Mar 5 12:17:01 ubuntu sshd[1943]: Failed password for admin from 192.168.0.14 port 50158 ssh2
Mar 5 12:17:18 ubuntu sshd[1943]: Failed password for root from 192.168.0.14 port 50158 ssh2
Mar 5 12:17:40 ubuntu sshd[1943]: Failed password for invalid user admin from 192.168.0.14 port 50158 ssh2
3. /var/log/kern.log
The /var/log/kern.log file contains messages specifically from the Linux kernel itself. These include hardware integration events, driver activities, and kernel crashes/panics.
Analyzing kern.log allows pinpointing hardware driver issues or investigating the cause of kernel panics on a system.
For example, a USB camera failure might log an error like:
Mar 1 09:17:23 ubuntu kernel: [22192.168561] usb 1-3: new high-speed USB device number 5 using xhci_hcd
Mar 1 09:18:34 ubuntu kernel: [29348.382024] uvcvideo 1-3:1.0: Entity type for entity Extension 4 was not initialized!
Mar 1 09:18:34 ubuntu kernel: [29348.382048] uvcvideo 1-3:1.0: Failed to initialize device control handler
4. /var/log/mail.log
The /var/log/mail.log file contains events and errors from mail servers like Postfix running on a system. Monitoring mail.log helps troubleshoot issues like lost emails or mail server misconfigurations.
For example, a mail server error might appear as:
Mar 5 12:02:11 ubuntu postfix/smtpd[1458]: "451 4.3.0 Helo command rejected: Host not found"
Mar 5 14:07:01 ubuntu postfix/cleanup[2045]: 7BF4B26805: message-id=<[email protected]>
Mar 5 16:09:45 ubuntu postfix/qmgr[1322]: 7BF4B26805: from=<[email protected]>, status=bounced (Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
5. /var/log/secure
Some Linux distributions like RedHat use /var/log/secure for authentication logs instead of /var/log/auth.log. But it serves the same purpose of recording user access events.
6. /var/log/boot.log
Systems using systemd init have /var/log/boot.log for logging the system boot process. This allows diagnosing startup issues by reviewing the boot sequence:
Starting Light Display Manager...
Reached target Graphical Interface.
Starting Update UTMP about System Reboot...
Started Daily apt upgrade and clean activities.
Started /etc/rc.local Compatibility.
Reached target Graphical Interface.
Started Daily apt download activities.
Started Getty on tty1.
7. /var/log/dmesg
The dmesg command shows the kernel ring buffer – a memory buffer storing recent kernel messages. /var/log/dmesg saves the non-persistent dmesg output, useful for deep kernel troubleshooting.
For example, it may reveal hardware detection problems:
[ 0.214223] microcode: CPU0: patch_level=0x000000c6
[ 1.037366] r8169 0000:03:00.0 enp3s0: unable to load firmware patch rtl_nic/rtl8168h-2.fw (-2)
[ 1.086814] r8169 0000:03:00.0: eth0: unable to load firmware patch rtl_nic/rtl8168h-1.fw (-22)
8. Distribution-specific Logs
Different Linux distributions can use additional syslog log directories:
- RHEL/CentOS –
/var/log/yum.log,/var/log/spooler/ - Debian/Ubuntu –
/var/log/apache2/,/var/log/apt/ - SUSE –
/var/log/zypper.log - Arch Linux –
/var/log/pacman.log
So check for any critical application logs under /var/log/ specific to your distribution.
According to experts, the standard syslog file locations will cover 80% of logging needs for most Linux users. But your distribution may use additional customized log directories as well.
How To Read and Monitor Syslog Files
There are various tools and methods for accessing syslog files on Linux:
cat – View Entire Log Contents
The cat command prints out the entire contents of a syslog file. For example:
cat /var/log/syslog
This will dump the full syslog file to your terminal.
less – Interactive Paging Through Logs
The less command allows interactively paging up/down through a syslog file:
less /var/log/auth.log
Within less, you can press Up/Down keys to scroll, / to search keywords, q to quit.
tail – View Just The Latest Entries
To see only the latest entries appended to a syslog, use tail -f:
tail -f /var/log/syslog
The -f option continuously outputs new lines added to the file. This acts like a live monitoring view.
grep – Filter Logs For Specific Events
You can filter syslog files using grep to match keywords:
grep "sshd" /var/log/secure
This will only output lines containing the sshd pattern, allowing you to isolate relevant log entries.
Log Management Tools
According to experts, large environments use dedicated log management platforms like Splunk, Graylog or Elastic Stack to aggregate logs from many servers into a centralized system for analysis and monitoring.
These tools provide advantages like search indexing, correlating events across sources, and real-time alerting. For single Linux devices, the command line options above usually suffice for most syslog access needs.
How Log Rotation Works in Linux Syslog
An important concept in syslog is log rotation. This is the automatic archival of older log files to prevent the active logs from growing infinitely large.
Here is how log rotation works on most Linux distributions:
-
The
logrotateutility handles rotating logs based on configs in/etc/logrotate.confand/etc/logrotate.d/. -
When triggered, logrotate archives older logs by compressing them into a file like
/var/log/syslog.1.gz. -
It then creates a fresh empty log file as the new active log, e.g.
/var/log/syslog. - Logrotate is usually scheduled to run daily, weekly, or monthly.
- The number of old log archives to retain before deletion is also configurable.
According to experts, a sane log rotation policy is critical to avoid clogging up the filesystem with huge log files. Most distributions come with sensible logrotate defaults out of the box.
Below is a graph showing the log rotation process visually:

As you can see, log archives are compressed and numbered by date while the core log file remains at a reasonable size.
Securing and Auditing Linux with Syslog
Syslog provides a detailed audit trail of system events that is invaluable for security and compliance purposes.
Here are some examples of using syslog for monitoring and hardening Linux security:
-
Suspicious authentication – Monitor
auth.logfor unusual failed login patterns, repeated brute force activity, or logins from unknown users. These could indicate compromised credentials. -
Privilege escalation – Watch
auth.logandsecurefor abnormalsudoactivity associated with normal users. This may signify an attempt to gain root access. -
User session tracking – Audit session start and end times in
auth.logto identify abnormal sessions that could mean unauthorized access. -
Attack correlation – Match up suspicious events across
auth.log,kern.log, and network daemon logs to identify and investigate multi-stage attacks. - Compliance reporting – Feed relevant syslog events into compliance systems to satisfy auditing requirements around access controls, system changes, etc.
According to cybersecurity experts, continuously monitoring syslog files is one of the most critical steps in securing and auditing Linux environments. The data contained provides visibility that is otherwise difficult to obtain.
Troubleshooting with the Power of Syslog
Syslog files provide tremendous value for troubleshooting all types of issues on Linux systems.
Here are some examples of how syslog can help identify and diagnose problems:
- Application crashes – Application fault messages and stack traces in syslog point to the cause of app or service disruptions.
- Resource contention – Kernel OOM killer events or high load avg in syslog can indicate contention leading to poor performance.
-
Hardware failures – Driver warning messages in
kern.logindicate faulty/failing hardware components like disks or NICs. - Network problems – TCP errors and connection resets in syslog denote network misconfiguration or flakiness causing connectivity issues.
-
Startup failures – Reviewing
boot.logreveals which services failed to start properly, pinpointing the culprit. -
Email delivery issues – Monitoring
mail.logallows troubleshooting email loss or blacklisting caused by mail server problems.
According to Linux experts, syslog files should always be an administrator‘s first stop when diagnosing ANY system or application issue. The additional context and clues from syslog logs dramatically simplifies root cause analysis.
Conclusion
I hope this guide gave you a solid understanding of where Linux stores syslog files and how to access them. While locations may vary across distributions, the standard /var/log directories outlined provide a wealth of system and application logging data.
Key takeaways include:
-
Check
/var/log/syslogfirst when troubleshooting, for an overview of system events. -
Monitor
/var/log/auth.logclosely for security and compliance auditing. -
Review
/var/log/kern.logto pinpoint hardware or driver issues. -
Use
tail -fto watch an active log file in real-time. -
Analyze syslog with tools like
grepto filter out noise.
Syslog gives you incredible visibility into your Linux systems – with good reason it‘s called the "crown jewels" of logging! Now that you know where syslog hides these jewels on your filesystem, go explore them to unlock their power.



