Problem Statement
Where are system logs typically stored in Linux?
Explanation
System logs stored in /var/log/ directory. Important logs: /var/log/syslog or /var/log/messages (general system messages), /var/log/auth.log (authentication logs), /var/log/kern.log (kernel messages), /var/log/apache2/ or /var/log/httpd/ (web server logs), /var/log/mysql/ (database logs). Logs rotate periodically to prevent disk fill.
View logs: tail -f /var/log/syslog follows log in real-time, grep 'pattern' /var/log/syslog searches logs, journalctl (systemd systems) queries systemd journal. Important for troubleshooting: check logs first when diagnosing issues, errors often logged before visible symptoms.
Log rotation: logrotate manages log rotation based on /etc/logrotate.conf and /etc/logrotate.d/. Rotates by size or time, compresses old logs, deletes old archives. Understanding log locations and management is essential for system troubleshooting and monitoring.
