Sylog Flashcards

1
Q

What are the systemd built-in logging frameworks?

A

1) systemd-journald
2) rsyslog

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Diff between:

1) systemd-journald
2) rsyslog

A

1) systemd-journald: stores journal in db
2) rsyslog: logs to /var/log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you query the systemd-journald database?

A

Use journalctl command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

which of these logging framework implements the syslog protocol:

1) systemd-journald
2) rsyslog

A

Both

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In syslog every event has two elements to it. Name them

A

1) Facility
2) Priority

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are some well known facilities

A

mail
authpriv
cron
kern
daemon
news
syslog
uucp
ftp
lpr
auth
local0 to local7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are some well known priorities?

A

debug
info
notice
warn
error
crit
alert
emerg

(Experts Alert: Diagnosing issues Needs Wise Error Checking)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is the daemon responsible for systemd-journald?

A

systemd-journald

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is the daemon responsible for rsyslog?

A

rsyslog NOT rsyslogd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where are rsyslog config stored?

A

/etc/rsyslog.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What do rsyslog rules capture?

A

Which message goes to which file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

General rule format of a rsyslog rule

A

FACILITY.PRIORITY[;EXCEPTED_FACILITY.none]* [-]/target/file

FACILITY.PRIORITY is called SELECTOR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the effect of a dash in front of a log file in /etc/rsyslog.conf

A

The dash causes the logs to be written asynchornously

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is the rsyslog drop in folder?

A

/etc/rsyslog.d/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you get help with rsyslog.conf?

A

man rsyslog.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Where do you put rsyslog custom configs?

A

Create a file and drop them in /etc/rsyslog.d/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the user definable facilities?

A

local0 to local7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Create a custom rsyslog rule for sshd

A
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Send a log message manually as the facility SSHD with priority INFO

A

logger -p local6.info ‘here is the message’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

By default, where are journals logged?

A

By default they are not logged. The volatile journal is used and saved in

/run/log/journal

which is deleted on reboot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

View the content of the journal on stdout

A

journatlctl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the order of journalctl messages?

A

oldest to newest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How do you view journal messages from newest to oldest

A

journalctl -r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

journalctl -f

A

stream the journal to stdout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Filter journal messages by priority and by unit
```journalctl -p err -u ssd```
26
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"```
27
What is the process with PID 1?
systemd
28
Print all journal by facility with PID 1
journaltcl _PID=1
29
Print all journal by user with ID 81
```journaltcl _UID=1```
30
How do you get help on journald
man journald.conf
31
What are storage options for journald?
auto (default) volatile none persistent
32
Make journal persistent
In /etc/systemd/journald.conf Storage=persistent ```systemctl restart systemd-journald```
33
List all journalctl boots
```journalctl --list-boots```
34
List journatlctl messages for a certain boot
journalctl -b 1
35
Display comprehensive time information on your server
timedatectl
36
What timezones are available so I may pick one
timedatectl list-timezones
37
Set timezone to Africa/Douala
timedatectl set-timezone Africa/Douala
38
Activate time synchronization
```timedatectl set-ntp true```
39
What is the time synchronization daemon?
chronyd (replaces ntpd)
40
Determine chronyd date sources
```chronyc sources```
41
what is tzselect
Timezone Select: utility that allows selection of time zone by menu navigation.
42
What are key system log files?
1) /var/log/messages 2) /varlog/secure 3) /var/log/cron 4) /var/log/maillog 5) /var/log/boot.log
43
What happens if a message is matched by many rules in rsyslog.conf?
The message is stored in all files with matching rule
44
none keyword in rsyslog.conf
indicates that no messages for the indicated facility are stored in the given file
45
Explain logrotate command
rotates log files to prevent them from taking too much space in the /var/log
46
key to successful use of the journal for troubleshooting and auditing
limit journal searches to show only relevant output.
47
Show 5 last entries of journal
journalctl -n 5
48
Different ways of filtering jorunalctl output
1) limit size with n option 2) tail with -f option 3) filter with since and until 4) filer by PID, UID, priority, user 5) filter by verbose field
49
Determine fields that you can filter journalctl output with
journalctl -o verbose
50
Popular journalctl fields that can be used for filter events
_COMM is the command name. _EXE is the path to the executable file for the process. _PID is the PID of the process. _UID is the UID of the user that runs the process. _SYSTEMD_UNIT is the systemd unit that started the process.
51
Explain volatile storage option
Stores journals in the volatile /run/log/journal directory
52
Explain auto storage option
If /var/log/journal exists, then persistent storage is used; otherwise it uses volatile is used.
53
Explain persistent storage option
Stores journals in /var/log/journal. If directory does not exist, then create it
54
How is journal data rotated?
journal has a built-in log rotation mechanism that triggers monthly
55
retrieves the entries from the current system boot only
journalctl -b
56
limits the output to only the previous boot
journalctl -b -1
57
Set time to 9:00:00
timedatectl set-time 9:00:00
58
stratum
number of hops that the machine is away from a high-performance reference clock
59
driftfile
a file (configured in /etc/chrony.conf) in which chronyd records the rate at which the RTC looses or gains time
60
what categories of time sources can you declare in /etc/chrony.conf
peer (same stratum) server (one level above)
61
Example server configuration in /etc/chrony.conf
``` server classroom.example.com iburst ```
62
tar -p option
preserve permissions
63
tar --selinux option
: Enable SELinux context support, and store SELinux file contexts.
64
tar -a option
--auto-compress : Use the archive's suffix to determine the algorithm to use
65
Explain ownership of extracted files
if root user extracts an archive, the original users and group ownership are preserved if regular user extracts an archive, he becomes the owner
66
How are permissions of extracted files determined?
if -p was used, then the original permissions are maintained otherwise, umask is used to determine the permissions.