Welcome Guest, Not a member yet? Register   Sign In
logrotate for log files
#1

I would like to logrotate my CI log files and keep 3 days worth of logs (3 as an example to keep the examples small) 

my  /etc/logrotate.d/gjtst    logrotate conf file
 
 /var/www/html/application/logs/*.php {
su www-data www-data
    rotate 3
    daily
    missingok
}

Before folder entries
log-2019-06-29.php
log-2019-06-28.php
log-2019-06-27.php
log-2019-06-26.php
...

After this run  logrotate -f -v /etc/logrotate.d/gjtst

After folder entries
log-2019-06-29.php.1
log-2019-06-28.php.1
log-2019-06-27.php.1
log-2019-06-26.php.1
...


Desired folder entries  I can live with changing the file name, I just want 3 versions

log-2019-06-29.php
log-2019-06-28.php
log-2019-06-27.php

What do I change to get the desired effect?

Or is there a simpler procedure for a lamp stack based system
a bash or php script I could put in a cron job?
I wrote my first program in 15 minutes. It took me 3 hours to keypunch it.

I wrote my first BASH script in 5 minutes. It took me a day to find out I had to put a . (period) in front of it to get it to execute.
Reply


Messages In This Thread
logrotate for log files - by gmgj - 06-29-2019, 07:18 AM
RE: logrotate for log files - by gmgj - 06-29-2019, 10:50 AM
RE: logrotate for log files - by sushiguru - 11-02-2022, 08:45 AM
RE: logrotate for log files - by akbarkhanhrp - 11-10-2022, 12:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB