Login
Howto rotate logs manually

Few days ago I needed to rotate few log files manually. Log file got too big because of the testing environment logging all data for easier tracking of any possible issues and it got to approx 1.5GB in size.

So after test environment was switched off I needed a clean log files to start with and see if there are any critical errors. There were not, but just in case :)

So here is what you need to do if you want to rotate the files manually (assuming you are using Linux) :

  1. sudo logrotate /etc/logrotate.d/[file_to_be_rotated ]
 
so in my case it was 3 log files to be rotated:
  1. sudo -v -f logrotate /etc/logrotate.d/mysql-server
  2. sudo -v -f logrotate /etc/logrotate.d/apache2
  3. sudo -v -f logrotate /etc/logrotate.d/cacti
 

there are 2 parameters I have used:
-v - Verbose
-f - Force rotation of logs even if not needed

Thats about it. Hopefully it was usefull tip and saved someone's day.