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

mail.log file - How do I divert mail log from certain user to another file?

Andy S
Advisor

mail.log file - How do I divert mail log from certain user to another file?

Folks,
I see that /var/adm/syslog/mail.log gets flooded with emails that get sent to a certain mail destination.

If I want to force these specific email related log entries to be sent to any file other than mail.log, how can I acomplish this?
Thanks
2 REPLIES
Steven E. Protter
Exalted Contributor

Re: mail.log file - How do I divert mail log from certain user to another file?

Shalom,

You don't.

Rotate the logs to a location with space. The syslog configuration is not meant to select data by user. It is meant to select data by daemon.

This would require a custom script to occasionally process the the data creating the second log file.

looking however at the syslogd man page there does appear to be the ability to log messages to a particular user.

Some amount of hacking might produce desired results.

--snippet--
For example, the configuration file:

kern,mark.debug /dev/console
mail.debug /var/adm/syslog/mail.log
*.info;mail.none /var/adm/syslog/syslog.log
*.alert /dev/console
*.alert root,eric,kridle
*.emerg *
*.emerg @admin

logs all kernel messages and 20 minute marks onto the system console,
all mail system messages to /var/adm/syslog/mail.log, and all messages
at info and above, except mail messages, to the file
/var/adm/syslog/syslog.log. Messages at alert and above are logged to
the console and to the users root, eric, and kridle if they are logged
in. emerg messages are written to all logged-in users' terminals, and

--end snippet--

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Pete Randall
Outstanding Contributor

Re: mail.log file - How do I divert mail log from certain user to another file?

Or a simple cron script could grep out the entries for that user on an hourly, daily, weekly basis.


Pete

Pete