Linux for Developers
/Beginner
System Logs (Syslog)
Definition
The standard protocol and directory structure (`/var/log`) used by Linux to persistently record events, warnings, and errors generated by the kernel, services, and applications.
Explain Like I'm New
The airplane's black box. Every time a user logs in, a network card fails, or a web server crashes, Linux quietly writes down exactly what happened and exactly what time it happened.
Real World Example
A server crashes and reboots randomly. The admin navigates to `/var/log` and reads the `syslog` (or `messages`) file. They find a log entry from 1 second before the crash saying 'Out of Memory: Killed process'.
Common Use Cases
- •Post-mortem debugging
- •Security auditing (checking failed login attempts)
Interview Questions
basic
- What specific directory on a Linux system holds almost all of the log files?
intermediate
- If a log file grows to 500 Gigabytes, it will crash the server. What Linux tool automatically compresses and deletes old logs to prevent this?