Explore common Linux and Windows log files to understand their structure and content.
Understanding the components of a log entry is crucial for effective log analysis.
When the event occurred. Format varies (syslog, ISO 8601, Unix timestamp).
The system that generated the log entry. Essential for distributed systems.
The program or service that generated the log. Helps categorize events.
Unique identifier for the process instance. Useful for tracking specific sessions.
The actual event description. Contains the details of what happened.
Indicates the importance of the event (0=Emergency to 7=Debug).
Configure and visualize how logrotate manages log files to prevent disk space exhaustion.
Master essential command-line tools for log analysis and extraction.
Understanding severity levels helps prioritize log analysis and alerting.
System is unusable. Immediate action required.
kernel: Kernel panic - not syncing
Action must be taken immediately.
database: Disk failure imminent
Critical conditions requiring attention.
apache: Cannot allocate memory
Error conditions that need resolution.
sshd: Failed password for user
Warning conditions that may require attention.
disk: 90% capacity reached
Normal but significant conditions.
systemd: Service restarted
Informational messages about normal operations.
sshd: User logged in successfully
Debug-level messages for development.
app: Function called with params...
Learn about collecting and aggregating logs from multiple systems.
# /etc/rsyslog.conf - Basic configuration
# Load modules
module(load="imuxsock") # Local system logging
module(load="imklog") # Kernel logging
# Global directives
$WorkDirectory /var/spool/rsyslog
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# Rules
*.info;mail.none;authpriv.none;cron.none /var/log/messages
authpriv.* /var/log/secure
mail.* /var/log/maillog
cron.* /var/log/cron
*.emerg :omusrmsg:*
# Forward logs to central server
*.* @@logserver.example.com:514
# Alternative: Save to file with specific format
$template CustomFormat,"%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%\n"
*.* /var/log/custom.log;CustomFormat
Category of the log source: kern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron, authpriv, ftp, local0-local7
Combination of facility and severity level. Example: mail.info, auth.warning, kern.emerg
UDP (514): Fast but unreliable. TCP (514/6514): Reliable with guaranteed delivery. TLS: Encrypted transmission.
Centralized storage, correlation across systems, easier compliance, reduced storage on endpoints, unified search and analysis.
# On the client (sender)
# /etc/rsyslog.d/50-remote.conf
*.* @@192.168.1.100:514 # TCP
# *.* @192.168.1.100:514 # UDP (@ = UDP, @@ = TCP)
# On the server (receiver)
# /etc/rsyslog.d/50-server.conf
module(load="imtcp")
input(type="imtcp" port="514")
# Template for remote logs
$template RemoteHost,"/var/log/remote/%HOSTNAME%/%PROGRAMNAME%.log"
*.* ?RemoteHost
Test your knowledge of log management concepts and best practices.