BianchiDude

Well-Known Member
PartnerNOC
Jul 2, 2005
617
0
166
What script is rotating my logs?

Ex:
-rw------- 1 root root 102437 Apr 3 13:34 secure
-rw------- 1 root root 2086462 Mar 30 03:32 secure.1
-rw------- 1 root root 690884 Mar 22 23:27 secure.2
-rw------- 1 root root 1087572 Mar 15 14:49 secure.3
-rw------- 1 root root 337965 Mar 9 03:52 secure.4

How does it know to make a secure.1 secure.2, etc. What if I want to change that? Or add a secure.5?
 

LiNUxG0d

Well-Known Member
Jun 25, 2003
206
1
168
Gatineau, Quebec, Canada
hmmmmmmmmm...

Hey there,

The crons are here: /etc/cron.daily/logrotate
You're probably looking for this folder for confs: /etc/logrotate.d/
This is the conf file for logrotate: /etc/logrotate.conf

In the /etc/logrotate.conf you'll notice a line that says "rotate 4" you can probably safely change that to "rotate 5" to get things rotated with .5 for example, but if I'm not mistaken, this will rotate ALL logs being rotated on a .5 basis.

I'm pretty sure that if you look at the individual files in "/etc/logrotate.d/" you'll see that some have the "rotate x" specified. If it's specified, it will rotate "x" times. If it's not set, it will use the default from the /etc/logrotate.conf file (4 times max, once a week). You may skip editing the logrotate.conf to avoid rotating ALL unspecified logs and just edit the /etc/logrotate.d/syslog file to have it look like so:

Code:
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
    [B]weekly[/B]
    [B]rotate 5[/B]
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
Another good command, in a shell: man logrotate

Just FYI. :)

Let me know if this helps you or not.
 
Last edited: