Linux Logging Flashcards
/user/log/dmesg
Kernel boot messages
/var/log/messages
Standard syslog messages
/var/log/secure
Security log messages. Info on login attempts.
/var/log/maillog
Local email log messages/
dmesg
Utility allowing an administrator to
view /var/log/dmesg file in text pager.
—level=,..:show levels specified. Abbreviated.
Ex: warn,err
-x:decode facility and level info to human readable.
Dmesg levels
0 emerg sys. unusable 1 alert immediate action 2 critical critical condition 3 err error condition 4 warn warning condition 5 notice normal but significant 6 info informational 7 debug debug-level
Kernel messages
user: random user-level
mail: mail system
daemon: system daemon
auth: security/authorization
syslog: messages generated by syslog
lpr: line printer subsystem
news: network news subsystem
syslog
Timestamp, hostname generating, item generating event message.
-f: real time output
logger
Command to send info to /var/log/messages
-t: tag in””
journalctl
Defaults to journal w. oldest date at top.
-b: boot up, since
—disk-usage: amount of disk space journal consuming
-e: end
-F: reverse and folllow
-k: kernel only
—list-boots: shows list of recorded boot sessions
-n: newest number
-o: output format
verbose: all entry items with fields
json-pretty
systemd-cat
—rotate: rotate journal files
—since: with —until displays logs within specific window with time format “yyyy-mm-dd hh:mm:ss”
—until:
-u: logs of unit.
-x: log lines with text from message catalog. Not all will be available.
systemd journal
Binary file on everything Kernel log msg. System log msg. With the same formatting as syslog. Syslog services output to stdout/stderr. Defaults to /run/log/journal. Volatile 1.1.1.1
journald configuration
/etc/systemd/journald.conf
[Journal]
Storage=
auto-default: will store to /var/log/journal and /run/log/journal
persistent: stored to /var/log/journal hierarchy
volatile: only sent to /run/log/journal
none: no data kept
SystemMaxUse=,RuntimeMaxUse=
SystemMaxFileSize=,RuntimeMaxFileSize=
MaxRetentionSec=
/etc/rsyslog.conf
Main configuration file for rsyslog logging daemon. SELECTOR LINES in format of .
Ex: *.info
File name off to the side indicates location.
With dash means that the recording can wait.
/etc/logrotate.conf
Main configuration file for rotate daemon responsible for managing storage and rotation of old files.
Can show rotate rate, keep size, date suffix, compression,
/etc/logrotate.d/
Extra logrotate config for other daemons to be placed.