[SunHELP] syslog send a mail

Matthew Hattersley matthewhattersley at businessserve.co.uk
Wed Jan 26 04:14:55 CST 2005


Your best bet is to create a log rotation script.... IE: pipe all the
authpriv messages to a given file. Once a day via a cron run a script
like this:

cp /var/log/auth.log /tmp/auth
echo "" > /var/log/auth.log		
# Echoing to the file as opposed to removing it and touching it ensures
# that the inode wil not be changed and logging will be consistant
body="Whatever"
subject="Auth Logs from: `date`"
from="test at test.com"
(echo $body; unix2dos /tmp/auth|uuencode /tmp/auth.txt) | mailx -s \
"$subject" -r "$from"

This script should send the log as an attachment, which keeps things
clean.

Hope this helps

Mat
On Wed, 2005-01-26 at 15:29 +0800, Cloud L. Lee wrote:
> Hi,
> Can syslogd send a mail to a user?
> For example, all authpriv.* messages will be send to someuser at somehost.com.
> How to do it?
> 
> 
> Thanks for help
> 
-- 
Matthew Hattersley <matthewhattersley at businessserve.co.uk>
Business Serve PLC



More information about the SunHELP mailing list