Shell: xargs with a pipe to send logs to logstash

I have been playing with Logstash this weekend and I believe I have everything setup the way I want, so to put Kibana 3 to que test, I wanted to inject all my MediaTemple logs into Logstash to start searching and get used to querying Kibana.

Hence something like this was used:

 

find . -name '*.processed' -print0 | xargs -I {} -0 -i sh -c 'cat {} | netcat 127.0.0.1 50000'

 

This will find all my logs ending in ".processed" send them to xargs that will cat each file and pipe it to netcat to my logstash instance listening on port 50000.

 

I'l post my conf files here, but there's nothing to fancy and their documentation is fantastic if I take too long to post.

 

 

  • IGlr