Sylog Flashcards
What are the systemd built-in logging frameworks?
1) systemd-journald
2) rsyslog
Diff between:
1) systemd-journald
2) rsyslog
1) systemd-journald: stores journal in db
2) rsyslog: logs to /var/log
How do you query the systemd-journald database?
Use journalctl command
which of these logging framework implements the syslog protocol:
1) systemd-journald
2) rsyslog
Both
In syslog every event has two elements to it. Name them
1) Facility
2) Priority
What are some well known facilities
mail
authpriv
cron
kern
daemon
news
syslog
uucp
ftp
lpr
auth
local0 to local7
What are some well known priorities?
debug
info
notice
warn
error
crit
alert
emerg
(Experts Alert: Diagnosing issues Needs Wise Error Checking)
what is the daemon responsible for systemd-journald?
systemd-journald
what is the daemon responsible for rsyslog?
rsyslog NOT rsyslogd
Where are rsyslog config stored?
/etc/rsyslog.conf
What do rsyslog rules capture?
Which message goes to which file
General rule format of a rsyslog rule
FACILITY.PRIORITY[;EXCEPTED_FACILITY.none]* [-]/target/file
FACILITY.PRIORITY is called SELECTOR
What is the effect of a dash in front of a log file in /etc/rsyslog.conf
The dash causes the logs to be written asynchornously
what is the rsyslog drop in folder?
/etc/rsyslog.d/
How do you get help with rsyslog.conf?
man rsyslog.conf
Where do you put rsyslog custom configs?
Create a file and drop them in /etc/rsyslog.d/
What are the user definable facilities?
local0 to local7
Create a custom rsyslog rule for sshd
echo 'SyslogFacility local6' > /etc/sshd_config.d/99-logging.conf
echo 'local6.*. /var/log/ssh.log' >> /etc/rsyslog.d/99-sshd.conf
systemctl restart sshd rsylog
Send a log message manually as the facility SSHD with priority INFO
logger -p local6.info ‘here is the message’
By default, where are journals logged?
By default they are not logged. The volatile journal is used and saved in
/run/log/journal
which is deleted on reboot
View the content of the journal on stdout
journatlctl
What is the order of journalctl messages?
oldest to newest
How do you view journal messages from newest to oldest
journalctl -r
journalctl -f
stream the journal to stdout
Filter journal messages by priority and by unit
journalctl -p err -u ssd
Filter journal messages by date range
journalctl --since "2023-11-05 10:20:12" --until "2023-11-05 10:30:12"
journalctl --since "-1 hour"