DevOps CheatSheet
DevOps CheatSheet
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
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
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