Created
June 6, 2014 07:34
-
-
Save notsobad/f754f06e46c90a641223 to your computer and use it in GitHub Desktop.
Send some syslog to hipchat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
log=/var/log/syslog.log | |
api_url='https://api.hipchat.com/v1/rooms/message?auth_token=XXXXXXXXXX' | |
tail -f $log|grep --line-buffered 'XXXXXXX'|while read line;do | |
msg=`echo "$line" | cut -d' ' -f5-` | |
echo 'Got' $msg | |
curl $api_url -vv -d "room_id=ops&from=Syslog¬ify=1&color=yellow&message_format=text" --data-urlencode "message=$msg @notsobad" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment