Skip to content

Instantly share code, notes, and snippets.

@moolex
Created April 24, 2017 07:36
Show Gist options
  • Save moolex/e05cf5cad026f54c38844c637b413ea0 to your computer and use it in GitHub Desktop.
Save moolex/e05cf5cad026f54c38844c637b413ea0 to your computer and use it in GitHub Desktop.
Tail files and send to nsq via curl (logs with json)
#!/bin/sh
tail -n0 -f $@ |
grep --line-buffered "" |
while read line;
do
echo $line && curl -s -d "{"$(echo $line | cut -d"{" -f2-) "http://127.0.0.1:4151/pub?topic=local_fs_tails" > /dev/null
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment