How to add a file to logrotate on Linux

Tyler Tyler (291)
3 minutes

If you have a log file that gets written to frequently, you will want to add it to logrotate so it doesn't consume all of your disk space. Logrotate will rotate the log according to your specifications and delete old logs.


Howchoo is reader-supported. When you buy through links on our site, we may earn a small affiliate commission at no cost to you.

Using your favorite editor (vim), edit /etc/logrotate.conf. vim /etc/logrotate.conf

At the end of logrotate.conf, add the full path to your log file followed by open and close curly brackets. There are many options you can add like the frequency to rotate "daily/weekly/monthly" and the number of rotations to keep "rotate 2/rotate 3". For a full list of options go to Each option gets added in between the curly brackets and on their own line.

Zach Zach (236)
5 minutes

SVGs are great; making them smaller makes them even greater. This guide will show you how to optimize SVGs.