Darn,

Isn't it always the case when you mail something off after scratching your
head for a while you stumble upon some new relevant piece of information.

Just added to my daily.local a regular cp command to copy out the mail log
for manual inspection.

Ran it as a test from the command line and mail reported that the message
was empty.

When I examined the temporary file it had only one line saying that the log
had been rotated... I thought this is strange since the rotation happened at
3am last night. Examined /var/log/maillog using more and sure enough there
were messages so I ran the script again and this time it worked.

It looks like maillog isn't actually being flushed for some reason until a
specific type of read operation is occurring on the log. - maybe this is
wrong but it looks that way.

I could work around this by zcat'ing the rotated log to sma but now I am
curious about the log flush post rotate.

-Andy

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Andrew Smith
Sent: 10 July 2006 10:16
To: misc@openbsd.org
Subject: really strange issue running sma from daily.local

I think this must be a misc issue rather than a ports issue but the issue
concerns the use of mail/sma in /etc/daily.local.

For several days I have had /etc/daily.local set up to run sma to produce an
ascii summary of /var/log/maillog as follows..

sma -a /var/log/maillog > /tmp/maillog.out
mail -s "Daily sendmail analysis" root < /tmp/maillog.out
rm /tmp/maillog.out

This invariably produces an empty maillog.out file when run from the
standard cron job.

I popped in various diagnostic steps including copying maillog to
maillog.dummy just to verify that the executable could process files when
run from cron (making sure that the rights and owner mirrored maillog
exactly and I got the dummy output but no actual output from the real
maillog.

I also made sure that newsyslog was scheduled to rotate /var/log/maillog at
a specific time rather than at a particular interval by changing the when
field in /etc/newsyslog.conf from 24 to $D03 for a 3am daily execution in
the belief that sma was actually seeing an empty file when it was run. -
Still no joy.

Any thoughts folks?

-Andy

Reply via email to