SUSE 10.3 and postfix/pflogsumm/logrotate

Discussion in 'Server Operation' started by pto44128, Mar 15, 2008.

  1. pto44128

    pto44128 New Member

    Per Falko's recommendation I have installed pflogsumm on my SUSE 10.3 Postfix based mail server, The SUSE implementation of logrotate adds a date stamp to the compressed log file name. As in maillog-20080314.bz2.
    I would like to keep this format for the other logs generated.
    The example postfix_report.sh I have has the file name for the compressed mail log hard coded (mail.log.0.bz2). Since the compressed SUSE mail log name changes, My script postfix_report does not work.
    I can run the postfix_report script manually, if I go in and edit the script and put in the current compressed mail log file name. pflogsumm is generating the proper info and passing it to postfix for delivery OK.
    Is there a way to...
    A: modify the postfix_report.sh to add the date variable to the mail log file name it accesses?
    B: Create an additional cron job creating a specific mail.log.0 file to be used by the postfix_report.sh and pflogsumm?
    This level of scripting is beyond my limited ability !

    Also: Are there any links out there to an explanation of how the SUSE implementation of logrotate actually works?

    Thanks in advance
    pto44128
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Instead of using

    Code:
    pflogsumm /var/log/maillog.0 | formail -c -I"Subject: Mail Statistics" -I"From: pflogsumm@localhost" -I"To: [email protected]" -I"Received: from www.example.com ([192.168.0.100])" | sendmail [email protected]
    in the /usr/local/sbin/postfix_report.sh script, you can try this:

    Code:
    [COLOR="Red"]yesterdaysdate=`/bin/date -d "1 day ago" +%Y%m%d`[/COLOR]
    pflogsumm /var/log/maillog-[COLOR="Red"]${yesterdaysdate}[/COLOR] | formail -c -I"Subject: Mail Statistics" -I"From: pflogsumm@localhost" -I"To: [email protected]" -I"Received: from www.example.com ([192.168.0.100])" | sendmail [email protected]
     
  3. pto44128

    pto44128 New Member

    Thank You
    I will attempt implemenatation of your suggestions shortly

    Additional issue with SUSE and logrotate.....
    I left my current logrotate script running over the weekend to verify what I had was working.
    To my surprise, the mail log is not being rotated daily as configured in /etc/logrotate.conf. (regardless of file name)
    If I add the -f switch to force a rotation, it works.
    Is there an additional configuration file I don't know about??

    pto44128
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Take a look at the /etc/logrotate.d directory.
     

Share This Page