Skip to main content

Lab 11.3 - Log Rotation

Objectives​

  • Configure logrotate
  • Create rotation rules
  • Test the rotation

Exercise 1: logrotate Configuration​

# View the config
cat /etc/logrotate.conf

# Create a rule
sudo nano /etc/logrotate.d/my-app

# Content:
# /var/log/my-app/*.log {
# daily
# rotate 7
# compress
# }

Lab created on: December 2024 - Tested on Ubuntu 24.04