Logrotate - I am not able to rotate files using logrotate

I have written script which is working in Home directory perfectly and also compressing log files and rotating correctly. But, when i try to run script for /var/log/ i am able to get compressed log files but not able to get rotation of compressed log files. Please suggest.
I am using below command to rotate the the cpmpressed files.

/usr/sbin/logrotate -s filepath/test.status filepath/test.conf

Note : I guess I don't have access related issue because i can move, delete compressed log file with same ID.
The files i am compressing and script stored have completely different paths. is it creating problem? please suggest.

Do you get an error message?

Have you tried --verbose option?

Hi Hanson44 thanks for reply..
I am not getting any error message. I can see even status of handleld files. When I tried debugging mode It's displaying message that No need of log rotation.

Well, that's a little progress. It's not rotating because possibly:

  • Files different between directory rotating and directory not rotating.
  • State file "knows about" the directory, do does not rotate.
  • Something messed up in the config file.

I noticed there is both -d and -v options to try. It sounds like you have already used at least one of those already, so you probably already have the diagnosis (thinks does not need to rotate).

I did notice there is a --force option to "force the rotation". Seems worth trying. I would try that.

Or, temporarily rename the state file, and try it to create new state file. Maybe the state file thinks "everything is OK".

Maybe you need to get rid of (archive somewhere else and delete from /var/log/) some of the old rotated files. Then start from scratch with the current log file.

I would save a directory listing (or just copy all the files somewhere), so in case it does something weird, you can return to previous state.

Hope this helps a little. Maybe someone else has better ideas.

Hi hanson44,
Thanks for help. with --force option it worked. :)Thanks for the help.

Great! I'm glad it's behaving.