Forum Discussion

Aftab_1138's avatar
Aftab_1138
Icon for Nimbostratus rankNimbostratus
Mar 30, 2009

Rotating custom log file

I have a log file setup in my system that captures logs from an iRule (using syslog-ng include file). I want to rotate the file on an hourly basis while keeping the other log files rotation the same (which is daily right now). I looked around and tried to implement a solution the following article:

 

 

https://support.f5.com/kb/en-us/solutions/public/8000/400/sol8430.html

 

 

I created a new log file under /etc with the following in it:

 

 

rotate log files daily

 

hourly

 

 

logrotate_enhance controls the log files life cycle

 

rotate 24

 

 

create new (empty) log files after rotating old ones

 

create

 

 

compress

 

compresscmd /usr/bin/nicegzip

 

 

w3c log rotation

 

/var/log/w3c {

 

hourly

 

compress

 

missingok

 

notifempty

 

}

 

 

Then I copied the logrotate script from /etc/cron.daily to /etc/cron.hourly and changed the logrotate.conf to my new config file (contents shown above). This does not seem to work. Is this the right way to accomplish my task?
  • I also tried the following include to try to rotate the log file using the configured daily schedule and this did not work either:

     

     

    b logrotate syslog include "/var/log/w3c {

     

    compress

     

    missingok

     

    notifempty

     

    }"
  • Were you ever able to resolve this? I have the same requirement, but I'm having trouble getting this to work too.
  • This is for the 10.x

     

    ================

     

    ================

     

     

    Please refer to the sol. http://support.f5.com/kb/en-us/solutions/public/7000/100/sol7115.html