{"id":1006,"date":"2014-01-06T01:21:07","date_gmt":"2014-01-06T09:21:07","guid":{"rendered":"http:\/\/blog.portnumber53.com\/?p=1006"},"modified":"2014-01-06T01:21:07","modified_gmt":"2014-01-06T09:21:07","slug":"shell-xargs-with-a-pipe-to-send-logs-to-logstash","status":"publish","type":"post","link":"https:\/\/blog.portnumber53.com\/index.php\/2014\/01\/06\/shell-xargs-with-a-pipe-to-send-logs-to-logstash\/","title":{"rendered":"Shell: xargs with a pipe to send logs to logstash"},"content":{"rendered":"<p>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.<\/p>\n<p>Hence something like this was used:<\/p>\n<p>&nbsp;<\/p>\n<pre>find . -name &#39;*.processed&#39; -print0 | xargs -I {} -0 -i sh -c &#39;cat {} | netcat 127.0.0.1 50000&#39;<\/pre>\n<p>&nbsp;<\/p>\n<p>This will find all my logs ending in &quot;.processed&quot; send them to xargs that will cat each file and pipe it to netcat to my logstash instance listening on port 50000.<\/p>\n<p>&nbsp;<\/p>\n<p>I&#39;l post my conf files here, but there&#39;s nothing to fancy and their documentation is fantastic if I take too long to post.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/blog.portnumber53.com\/index.php\/2014\/01\/06\/shell-xargs-with-a-pipe-to-send-logs-to-logstash\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[206,224,225,235,255,284,367],"class_list":["post-1006","post","type-post","status-publish","format-standard","hentry","category-linux","tag-kibana-3","tag-logs","tag-logstash","tag-mediatemple","tag-netcat","tag-query","tag-xargs"],"_links":{"self":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/1006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/comments?post=1006"}],"version-history":[{"count":0,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/1006\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/media?parent=1006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/categories?post=1006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/tags?post=1006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}