Linux Logs Management Flashcards

1
Q

What is the name of the logging daemon

A

Systemd-journald

or rsyslogd

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

Where is the rsyslogd config file?

A

/etc/rsyslog.conf

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

How would you structure an rsyslog rule

A

facility.priority action (the location to send the log)

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

what are 10 valid rsyslog facility codes?

A

auth
authpriv
cron
daemon
kern
lpr
mail
news
security
user

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

What are 8 valid rsyslog priority codes
listed lowest to highest

A

debug
info
notice
warning
err
crit
alert
emerg

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

What directory are log files usually sent to?

A

/var/log

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

How do you manage space the logs take up

A

Use logrotate

/etc/logrotate.conf

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

How do you securely remove a file (overwrite and obfuscate)

A

shred
Use -f to force permission changes to allow overwriting
Use -n to adjust number or overwrites (default 3)

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

What is a quick way of creating a new empty file?

A

touch NEWFILE

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

How might you keep an eye on a log file as it updates?

A

Tail -f FILE

-f (—follow)

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

How does “locate” command work?

A

It searches a daily updated database: mlocate.db

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

What are 3 commonly used options for the “locate” command?

A

-A Match all patterns
-b Only the file names, not directories
-i Ignore case

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

Name five useful options/expressions for the “find” command

A

-iname Search by name case-insensitive
- type File type i.e. f. d. l
- exec COMMAND{};
- mtime find files on modification time
- empty
- nouser
-perm

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

Access Execute mode in Vi

A

:

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

Access command mode in Vi

A

ESC

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

Access input mode in Vi

A

i

17
Q

Save a document in Vi

A

get onto execute mode then W (to write)

18
Q

How to delete a line in Vi

A

dd from insert mode
:d via command mode

19
Q

How to quit Vi without saving

A

:q!

20
Q

How do you search in V

A

From command /STRING

21
Q

Search and replace all instances of string in document with Vi

A

%s/ORIGINAL/REPLACE

22
Q

Use vi to open and jump directly to the first (searched) instance of a string

A

vi +/STRING /FILEPATH

23
Q

Navigate without arrows in Vi

A

H J K L

24
Q

Enter insert mode while creating a new line in Vi

A

O for a line above the cursor or o for a line below

25
Q

How to copy/cut in Vi

A

yy for a line
Or line range is. LINE,LINEy

26
Q

How to switch files in Vi

A

:e FILE

27
Q

Where would you find dmesg and syslog (mesg in some Rhel)?

A

/var/log

28
Q

What are 6 valid rsyslog actions?

A

Forward to a file
Pipe to an app
Display
Send to remote host
Send to a list of users
Send to all logged in users

29
Q

Where is the systemd-journald config file?

A

/etc/systemd/journald.conf

30
Q

journald logs to binary files so can’t be checked with text tools, what tool should you use?

A

journalctl

31
Q

What are five common journalctl command options

A

-a All data fields
-e starts at end of journal with pager
-l All printable fields
-nNUM Recent NUM of entries
-r reverse output