Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th March 2008, 17:18
pto44128 pto44128 is offline
Junior Member
 
Join Date: Oct 2007
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default SUSE 10.3 and postfix/pflogsumm/logrotate

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
Reply With Quote
Sponsored Links
  #2  
Old 16th March 2008, 14:36
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,739 Times in 2,574 Posts
Default

Instead of using

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

Code:
yesterdaysdate=`/bin/date -d "1 day ago" +%Y%m%d`
pflogsumm /var/log/maillog-${yesterdaysdate} | formail -c -I"Subject: Mail Statistics" -I"From: pflogsumm@localhost" -I"To: postmaster@example.com" -I"Received: from www.example.com ([192.168.0.100])" | sendmail postmaster@example.com
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 17th March 2008, 17:28
pto44128 pto44128 is offline
Junior Member
 
Join Date: Oct 2007
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #4  
Old 18th March 2008, 16:27
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,739 Times in 2,574 Posts
 
Default

Take a look at the /etc/logrotate.d directory.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:27.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.