0% found this document useful (0 votes)
162 views2 pages

DevOps CheatSheet

Uploaded by

Evey Reis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views2 pages

DevOps CheatSheet

Uploaded by

Evey Reis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Lesson 19 - Logging

Commands

Lastlog​-​ when they last logged in: last login date time
Lastb ​- Contains failed login attempts.
tail -f​ or ​tailf​ and ​watch​ - Monitor logs in real time

Directories

/var/log​ - ​Where logs are stored


/etc/logrotate.d​ - Contains application-specific configuration files and log settings
/var/log/secure​ - security and authentication logins/messages

Syslog -System logs


Rsyslog- Analyzes log messages according to a pattern and extracts variables from
them

Configuration files

/etc/logrotate.conf ​- Log rotation configuration for all the log files are specified in
this file
/etc/rsyslog.conf - ​Specifies rules for logging

Facility - ​Determines where the message is coming from in the configuration file
Priority -​Level of importance in syslog messages

Hands-on

How to generate log files from /etc/rsyslog.conf

1. Vim /etc/rsyslog.conf
- daemon.* /var/log/daemonlogs
- :wq
2. systemctl restart rsyslog
3. Cat /var/log/daemonlogs
4. logger -p daemon.err "This is err daemon test message"
5. Cat /var/log/daemonlongs
How to generate file in /etc/logrotate.d

1.cd /etc/logrotate.d/
2. Vim linuxcareer
- Edit file like below
/var/log/linuxcareer.log {
missingok
notifempty
maxsize 100M
weekly
dateext
rotate 4
create 0600 root root
}
-:wq
3. echo "I got a new job offer" > /var/log/linuxcareer.log
4. systemctl restart rsyslog
5. logrotate -f /etc/logrotate.conf
6. Cat /var/log/linuxcareer.log

General info
Directories
Commands
Configuration files
Hands-on

Lesson 20 -Archiving

You might also like