Skip to content

Instantly share code, notes, and snippets.

@notsobad
Created June 6, 2014 07:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save notsobad/f754f06e46c90a641223 to your computer and use it in GitHub Desktop.
Save notsobad/f754f06e46c90a641223 to your computer and use it in GitHub Desktop.
Send some syslog to hipchat
#!/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&notify=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