A log file records events, errors, warnings, access attempts, service activity, and system behavior. For a system administrator, logs are the main evidence source for troubleshooting.
Simple explanation
When a service fails, Linux usually leaves clues in logs. Logs show what happened, when it happened, which service was involved, and sometimes why it failed.
Why it matters
Without logs, troubleshooting becomes guessing. With logs, an administrator can trace failure from symptom to root cause.
Real VPS example
If Nginx returns 502 Bad Gateway, check Nginx error logs, PHP-FPM logs, service status, and journalctl before changing random settings.
What breaks if you ignore it
You may fix symptoms, miss attacks, overlook disk growth, or repeat the same incident because the real cause was never found.
System Administrator Operating Notes
Core principle, commands, verification, troubleshooting, rollback, and cloud/security connection.
Foundation
Skill Level
foundation
System Layer
monitoring
Core Principle
Logs are evidence. They turn troubleshooting from guessing into a traceable investigation.
Mental Model
Think of logs as the black box recorder of the server. When something breaks, logs tell the timeline and the failure signal.
When To Use
Use this when a service fails, a website returns errors, login attempts look suspicious, disk grows quickly, or performance changes suddenly.
Wrong Assumption
Beginners often ignore logs and search for random fixes. A real administrator reads logs before changing configuration.
Commands
Command Goal
Find the correct log, filter recent errors, identify timeline, and connect log messages to service behavior.
Primary Command
journalctl -xe; journalctl -u nginx --no-pager -n 100; tail -f /var/log/nginx/error.log; grep -i error /var/log/syslogCommand Breakdown
journalctl reads system logs. -u filters by service. tail follows live logs. grep filters useful patterns.
Safe Check Command
date; systemctl status nginx --no-pager; ls -lah /var/log; journalctl --disk-usageExpected Output
Logs should show clear recent events. Log files should not consume uncontrolled disk space. Critical service errors should be explainable.
Verify Command
journalctl -u nginx --since '1 hour ago' --no-pager; tail -n 100 /var/log/nginx/error.log; grep -i 'failed|error|denied' /var/log/syslogTroubleshooting
Common Failures
Wrong log file, logs too large, rotated logs ignored, permission denied, missing timestamp context, repeated error loop, or silent service failure.
Log Files
/var/log/syslog; /var/log/auth.log; /var/log/nginx/error.log; /var/log/nginx/access.log; /var/log/mysql/error.logDebug Commands
journalctl -u SERVICE --since today; tail -f LOGFILE; grep -R PATTERN /var/log; zgrep PATTERN /var/log/*.gzRoot Cause Map
Start from incident time, read related service logs, match error with status and config, then verify the fix with fresh log output.
Fix Pattern
Collect evidence first, make one change, reload service, then watch logs again to confirm whether the error disappears.
Risk & Recovery
Risk Level
medium
Backup Before Change
Before rotating, truncating, or deleting logs, save the relevant incident lines and confirm whether logs are needed for security review.
Rollback Plan
Restore logrotate settings, restart logging service if needed, and verify new logs are being written after rollback.
Blast Radius
Medium. Bad log handling can hide incidents, fill disk, or remove evidence needed for recovery.
Security Note
Auth logs and web access logs may reveal attacks. Do not ignore repeated failed logins, suspicious user agents, or unexpected admin access.
Strategic Value
Cloud Connection
Cloud logging systems extend local logs into centralized monitoring, alerting, retention, and incident review.
Automation Opportunity
Automate log pattern checks for failed logins, 5xx errors, disk warnings, service failures, and SSL renewal errors.
Interview Value
Log reading separates real system administrators from command copiers in interviews and production work.
Related Concepts
journalctl, syslog, auth.log, nginx logs, mysql logs, logrotate, incident timeline, troubleshooting