General
cancel
Showing results for 
Search instead for 
Did you mean: 

/var/adm/syslog/mail.x scripts ??

Kristopher March
Regular Advisor

/var/adm/syslog/mail.x scripts ??

How do you all go about sorting the mess in the mail log files?

I'm working on a script to count the number of e-mails in and out in say a 24 hour period, among other possibilities.

Please provide some additional ideas for me.
"This ain't no burger flippin job!"
2 REPLIES
Mark Grant
Honored Contributor

Re: /var/adm/syslog/mail.x scripts ??

We don't get much mail through our servers but you can trim them. Keep the last 500 hundered lines or so and lose the rest.

Counting e-mails in a unix mailbox is quite simple. I once looked at the source of "mail" trying to find how to determine the end of one and the beginning of the next and was surprised to find it used the "Received" field. You need an exact match on this entire field because the word "received" pops up a lot in emails :)
Never preceed any demonstration with anything more predictive than "watch this"
Dave La Mar
Honored Contributor

Re: /var/adm/syslog/mail.x scripts ??

Kris -
Would
more mail.log | grep 'Nov 5' | grep 'to=' | wc -l
serve your purpose?

Best regards,
dl
"I'm not dumb. I just have a command of thoroughly useless information."