Post

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:

1
COMMAND | while read -r line; do echo "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee $line" > /dev/tcp/data.logentries.com/80; done

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

For example:

1
lsblk | while read -r line; do echo "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee $line" > /dev/tcp/data.logentries.com/80; done

Hopefully this helps someone other than myself :)

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

Comments powered by Disqus.