The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

What script is rotating my logs?

Discussion in 'General Discussion' started by BianchiDude, Apr 3, 2008.

  1. BianchiDude

    BianchiDude Well-Known Member
    PartnerNOC

    Joined:
    Jul 2, 2005
    Messages:
    619
    Likes Received:
    0
    Trophy Points:
    16
    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?
     
  2. LiNUxG0d

    LiNUxG0d Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    206
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    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.
     
    #2 LiNUxG0d, Apr 3, 2008
    Last edited: Apr 3, 2008
  3. BianchiDude

    BianchiDude Well-Known Member
    PartnerNOC

    Joined:
    Jul 2, 2005
    Messages:
    619
    Likes Received:
    0
    Trophy Points:
    16
    Helpful, thanks!

    :)
     
Loading...

Share This Page