Created
November 26, 2016 15:05
-
-
Save rikwatson/b42b0f66a36e3df52196afc50c878919 to your computer and use it in GitHub Desktop.
Stream any log file to Slack using curl
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 | |
tail -n0 -F "$1" | while read LINE; do | |
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \ | |
"payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" "$2"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
echo "$LINE"
instead ofecho $LINE
will prevent*
characters to output the list of files in the cwd