Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple shell script to monitor a log file (e.g. TYPO3 syslog) and push it to a slack channel
tail -n 1 -f /var/path/to/file.log | while read line; do
echo $line | grep -v "PATTERN TO IGNORE"
if `test $? -eq 0`; then
cleanLine=`echo $line | tr -d '"'`
payload="payload={\"channel\": \"#channel\", \"username\": \"dev:typo3-sys.log\", \"text\": \"$cleanLine\", \"icon_emoji\": \":interrobang:\"}"
curl -X POST --data-urlencode "$payload"\?token\=TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.