Pipe Command Output to Logentries

I’ve been using Logentries for a couple of months now to manage variou project logs and have found it to be extremely convenient.

If you want to retrofit a crontab or any other process to use the Logentries Token-TCP type log, just do the following:

COMMAND | while read -r line; do echo "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee $line" > /dev/tcp/; done

Where aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee is your log token, and COMMAND is whatever your like.

For example:

lsblk | while read -r line; do echo "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee $line" > /dev/tcp/; done

Hopefully this helps someone other than myself :)

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.