4

I have installed Logrotate in my system. My Log file name is like : log-2015-09-09.php Here is my configuration in etc/logrotate.conf file :

/home/root/php/www/myProject/CI/application/logs/log-%Y-%m-%d.php{
        daily
        size 1K
        copytruncate
        compress
        rotate 1
        notifempty
        missingok
}

When i check status using :

cat /var/lib/logrotate/status

It did not show me anything about my logs and also did not delete or compress my log files. Is there something wrong in my configuration that i need to change.

Nilesh Kumar
  • 370
  • 2
  • 3
  • 16

1 Answers1

0

I would imagine that the directory/file name is the cause here. I'm not sure what you are tying to do with the % in there, but you can use wildcards instead like:

/home/root/php/www/myProject/CI/application/logs/log-*.php {
    daily
    size 1K
    copytruncate
    compress
    rotate 1
    notifempty
    missingok
}

You could also test the logrotate too using:

logrotate -d -f /etc/logrotate.conf

-d = Turns on debug mode and no changes will be made to the log files.

-f = Tells logrotate to force the rotation, even if it doesn't think this is necessary

AJReading
  • 1,193
  • 20
  • 35
  • I follow your instruction and check status using : logrotate -d -f /etc/logrotate.conf I got following error : rotating pattern: /home/root/php/www/myProject/CI/application/logs/log-*.php forced from command line (1 rotations) empty log files are not rotated, old logs mailed to myemail@gmail.com switching euid to 0 and egid to 104 error: error switching euid to 0 and egid to 104: Operation not permitted – Nilesh Kumar Sep 24 '15 at 17:50
  • Hi i can see now zip file(log-2015-09-08.php.1.gz) but these zips are not deleting. I want to delete these zips and there corresponding php file. – Nilesh Kumar Sep 25 '15 at 13:54
  • I am facing these same issues, zip files are not deleting by own. – mohit Sep 28 '15 at 13:38