A script used to tail a logfile and post newlines to a slack webhook. Original script taken from this Postman Blog. In practice, I expect that it will be modified slightly (it'd be nice to know the name of the file it's tailing).
Download or copy the slack-logger.sh
file.
Make the shell script executable using:
chmod +x slack-logger.sh
Run the shell script, passing in the name of the file you wish to tail and the Slack webhook URL.
./slack-logger.sh nginx.log https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXX
Additionally, you can make it so that the script only posts lines with a specific keyword in it by passing a 3rd argument:
./slack-logger.sh nginx.log https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXX err