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.

Increase Logs Archiving Duration

Discussion in 'E-mail Discussions' started by Osama Tariq, Jun 7, 2016.

Tags:
  1. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    187
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Lahore, Pakistan
    cPanel Access Level:
    Root Administrator
    Twitter:
    I want to increase exim logs archiving during up to 5 Years. What changes need in "/etc/logrotate.d/exim"
     
  2. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Here's my exim file. It rotates every 90 days, compresses daily (I have scripts that search these automatically), and stores the files in a separate directory:


    Code:
    /var/log/exim_mainlog {
        daily
        rotate 90
        olddir /var/log/exim/messages
        create 0640 mailnull mail
        compress
        postrotate
        /usr/bin/killall -HUP exim
        endscript
    }
    /var/log/exim_paniclog {
        daily
        rotate 90
        olddir /var/log/exim/panics
        missingok
        create 0640 mailnull mail
        compress
        postrotate
        /usr/bin/killall -HUP exim
        endscript
    }
    /var/log/exim_rejectlog {
        daily
        rotate 90
        olddir /var/log/exim/rejects
        create 0640 mailnull mail
        compress
        postrotate
        /usr/bin/killall -HUP exim
        endscript
    }
    
    You'd want to change that
    Code:
    rotate 90 
    
    to
    Code:
    rotate 1825
    
    I'd definitely recommend placing them somewhere other than /var/log , as /var/ is likely not going to be able to handle 5 years of data.
     
  3. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Also, you might want to take a look at this 3rd party site linuxconfig.org/logrotate. It'll help you understand what all that does ;)
     
    #3 twhiting9275, Jun 7, 2016
    Last edited by a moderator: Jun 7, 2016
  4. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    187
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Lahore, Pakistan
    cPanel Access Level:
    Root Administrator
    Twitter:
    Thanks.
    I have done it:


    Code:
    /var/log/exim_mainlog {
        create 0640 mailnull mail
        compress
        rotate 262
        postrotate
        /usr/bin/killall -HUP exim
        endscript
    }
    
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, as mentioned, you may encounter disk space availability issues should you decide to keep the log archives for an extended period of time. Ensure you review the available disk space on the system on a regular basis if the size of the drive/partition is small.

    Thank you.
     
  6. Osama Tariq

    Osama Tariq Well-Known Member

    Joined:
    Nov 27, 2014
    Messages:
    187
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Lahore, Pakistan
    cPanel Access Level:
    Root Administrator
    Twitter:
    disk space doesn't matter, i have alot of free space. Moreover let me know how can i increase dovecot log archiving such as `/var/log/maillog`
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can use the same method that was explained for /var/log/exim_mainlog for the /var/log/maillog file using LogRotate. It's grouped with other system log files by default in:

    Code:
    /etc/logrotate.d/syslog
    You could remove the entry from that file and create a new one for /var/log/maillog exclusively, using the template from other files in the /etc/logrotate.d/ directory.

    Thank you.
     
Loading...

Share This Page