LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-09-2009, 12:05 PM   #1
mboudro
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Rep: Reputation: 0
After log roll, Postfix cannot write to log file, Ubuntu 8.04


After the syslog facility rolls logs weekly, the Postfix cannot seem to write properly to the mail.log file. What I don't quite understand is that Postfix is still able to write the following error to the log file:

..."status=deferred (temporary failure. Command output: Can't open log file /var/log/mail.log: Permission denied )"

It is my understanding that Postfix uses several different processes to write to log files, but I'm confused as to why it is able to write errors to the log but not able to write when sending/receiving mail. After I chmod 777 the mail.log file, Postfix slowly clears the queue and the mails are then received. Everything functions fine for another week, until the logs roll again.

Anyone have any suggestions?
 
Old 02-10-2009, 08:48 AM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by mboudro View Post
After the syslog facility rolls logs weekly, the Postfix cannot seem to write properly to the mail.log file. What I don't quite understand is that Postfix is still able to write the following error to the log file:

..."status=deferred (temporary failure. Command output: Can't open log file /var/log/mail.log: Permission denied )"

It is my understanding that Postfix uses several different processes to write to log files, but I'm confused as to why it is able to write errors to the log but not able to write when sending/receiving mail. After I chmod 777 the mail.log file, Postfix slowly clears the queue and the mails are then received. Everything functions fine for another week, until the logs roll again.

Anyone have any suggestions?
Make sure you're restart postfix after the log rotation, most log rotation programs have a way of doing this. You could also be having problems with file permissions/ownership after log rotation also and there are options for setting that in logrotate's conf also.

See: create directive and postrotate directive for logrotate if that's what you're using.

Last edited by rweaver; 02-10-2009 at 08:55 AM.
 
Old 02-10-2009, 11:18 AM   #3
mboudro
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by rweaver View Post
Make sure you're restart postfix after the log rotation, most log rotation programs have a way of doing this. You could also be having problems with file permissions/ownership after log rotation also and there are options for setting that in logrotate's conf also.

See: create directive and postrotate directive for logrotate if that's what you're using.
I found the directive you were speaking of, therefore I added a script to change the permissions of the mail.log file, done at the postrotate prerogative. Hopefully this will solve the problem, but I will have to wait until next week to find out.

Thanks for your help rweaver.
 
Old 02-10-2009, 03:50 PM   #4
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by mboudro View Post
I found the directive you were speaking of, therefore I added a script to change the permissions of the mail.log file, done at the postrotate prerogative. Hopefully this will solve the problem, but I will have to wait until next week to find out.

Thanks for your help rweaver.
No problem
 
Old 02-11-2009, 03:57 AM   #5
Mapache
LQ Newbie
 
Registered: Feb 2009
Posts: 1

Rep: Reputation: 0
My 2 cents

I have the same problem and I've found two solutions:
  1. Use two cron jobs to change, on boot and weekly, the mail.log group to vmail and chmod it to 660. (Depends on when your syslog rotates mail logs)
  2. Modify /etc/init.d/sysklogd inside fix_log_ownership() function to do the same (chgrp and chmod)
I don't know if when syslog is updated /etc/init.d/sysklogd will be overwritten and so the cron jobs would be better.

Regards.
 
Old 02-11-2009, 10:07 AM   #6
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by Mapache View Post
I have the same problem and I've found two solutions:
  1. Use two cron jobs to change, on boot and weekly, the mail.log group to vmail and chmod it to 660. (Depends on when your syslog rotates mail logs)
  2. Modify /etc/init.d/sysklogd inside fix_log_ownership() function to do the same (chgrp and chmod)
I don't know if when syslog is updated /etc/init.d/sysklogd will be overwritten and so the cron jobs would be better.

Regards.
If you're using the logrotate package you can also just set it in the configs so after it rotates the files it automatically sets the perms they need or restarts the service (either can cause it to not be able to write to the file.)
 
Old 09-17-2010, 03:10 AM   #7
doru
Member
 
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 138

Rep: Reputation: 19
I have a similar problem:
http://www.linuxquestions.org/questi...in-log-831833/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Bash] log file roll over issues noir911 Programming 11 07-24-2008 01:48 AM
write mail log to /var/log/maillog jimmyjiang Red Hat 4 01-15-2008 06:18 PM
Postfix Error in log file shawnbishop Linux - Software 1 02-28-2007 09:00 AM
Write Error Log to Text File jamez15 Linux - General 3 07-02-2006 07:32 PM
Postfix log file paddyjoy Linux - Newbie 2 12-29-2005 07:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration