I want to log stdout from some programs to loggly. There are a few simple utilities out there that I've found (e.g. https://github.com/meatballhat/loggly-pipe and https://github.com/segmentio/loggly-cat), but they seem like they're overkill.
Could I get away with doing something this simple:
log.sh
:
#!/bin/bash
while read line
do
echo "$line"
curl -H "content-type:text/plain" -d "$line" https://logs-01.loggly.com/inputs/<my-token>/tag/tag1,tag2/ >/dev/null 2>&1
done < /dev/stdin
Then I run my program and pipe it to my loggly logging script:
./my_script.sh | ./log.sh
This seems to work okay, but I wonder if all the complicated-ness of the other solutions out there is necessary for some reason?
Could anything go wrong here?
Thanks!