Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with syslog

Status
Not open for further replies.

llingf

Technical User
Oct 3, 2002
25
0
0
US
Hi everyone:

I need some help with sylog,
I'm currently using syslog on my system,
and I'm looking for a way to send e-mail alert from authlog
and error logs to my e-mail account each day. Does any one know how to do that? I know logdog can do it, but I have problem to configuring it to send me e-mail.

Thanks in advance.

Ling.
 
You could use a cron job such as the following (all on one line):

[tt]59 23 * * * grep "^`date +'\%b \%e'`" /var/adm/messages | mail -s "messages log for `date +'\%b \%e'`" you@example.com[/tt]

What kind of problem are you having sending email from logdog?

Annihilannic.
 
hi Annihilannic:
Thanks for the reply. I ran your line into my cron job and
got e-mail back says grep: RE error 25: ``\digit'' out of range. I'm not very good at scripts, can you tell me what cause the error.

Thanks for helps.

ling
 
That's strange... with cron you usually need to escape %'s, but it doesn't seem to work either way in this case.

Try putting these commands into a script instead. Make sure it is executable, and then run it from cron.

Code:
#!/bin/ksh

grep "^`date +'%b %e'`" /var/adm/messages | mail -s "messages log for `date +'%b %e'`" you@example.com


Annihilannic.
 
Hi Annihilannic:

Thanks for the help, It worked. I'm really appreciat it.

Ling
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top