gopher2x
September 25th, 2010, 02:54 PM
folks i have a logfile that i would like to be notified via email when there is a certain occurrence of an event.
Right now i can monitor the file like this
tail -f /var/log/events.log | grep 2331
i will see only events from station 2331
now i have figured out command line email with sendemail
sendemail -f src@email.com -t dst@email.com -m test -s smtp.email.com:587 -o tls=yes -xu username -xp password -u Subject -m message
I can specify the message body by
-m "message",
STDIN,
or -o message-file=FILE
So how can i connect my grepped logs to this email. Needs to happen 24/7, and needs to happen as soon as the event occurs, no cron jobs every now and then...
i have tried
tail | grep | sendemail
but sendemail gives up waiting for the CTRL-D it...
any ideas??????
Right now i can monitor the file like this
tail -f /var/log/events.log | grep 2331
i will see only events from station 2331
now i have figured out command line email with sendemail
sendemail -f src@email.com -t dst@email.com -m test -s smtp.email.com:587 -o tls=yes -xu username -xp password -u Subject -m message
I can specify the message body by
-m "message",
STDIN,
or -o message-file=FILE
So how can i connect my grepped logs to this email. Needs to happen 24/7, and needs to happen as soon as the event occurs, no cron jobs every now and then...
i have tried
tail | grep | sendemail
but sendemail gives up waiting for the CTRL-D it...
any ideas??????