{"id":2818,"date":"2015-12-23T00:48:44","date_gmt":"2015-12-23T00:48:44","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=2818"},"modified":"2015-12-23T00:48:44","modified_gmt":"2015-12-23T00:48:44","slug":"monitor-appharbor-with-the-elk-stack","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/monitor-appharbor-with-the-elk-stack\/","title":{"rendered":"Monitor AppHarbor with the ELK Stack"},"content":{"rendered":"<p>If you followed my previous post on <a href=\"\/blog\/installing-the-elk-stack-on-azure\">setting up the ELK stack on Azure<\/a>, you can configure AppHarbor to use it fairly easily.<\/p>\n<p>You need to open a port on Azure (I&#8217;ve chosen 9000). You can set the inbound IP range to AppHarbors IPs<sup><a href=\"#footnote_0_2818\" id=\"identifier_0_2818\" class=\"footnote-link footnote-identifier-link\" title=\"https:\/\/support.appharbor.com\/kb\/tips-and-tricks\/application-server-ips-ec2-configuration\">1<\/a><\/sup>.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2015\/12\/image1-1-578x316.png\" alt=\"image1\" width=\"578\" height=\"316\" class=\"aligncenter size-large wp-image-2823\" \/><\/p>\n<p>Once you do this, make a new file in \/etc\/logstash\/conf.d called AppHarbor.conf, and enter the following into it&#8217;s contents:<\/p>\n<pre lang=\"Javascript\">\ninput {\n  tcp {\n    port => 9000\n    type => syslog\n  }\n  udp {\n    port => 9000\n    type => syslog\n  }\n}\nfilter {\n   grok {\n        match => [ \"message\",  \"%{GREEDYDATA:syslog_message}\" ]\n   }\n   mutate { replace => { type => \"appharbor\" } }\n}\noutput {\n  elasticsearch {\n    hosts => \"localhost\"\n  }\n}\n<\/pre>\n<p>While the AppHarbor logs supposedly conform to &#8220;syslog&#8221; format, I did not find this to be true &#8211; as of this time, I haven&#8217;t established the best log format yet, but this is easier to control than using &#8220;syslog&#8221; as an input type.<\/p>\n<p>If you don&#8217;t do this, you will get a lot of messages tagged with &#8220;grokparsefailure_sysloginput&#8221;.<\/p>\n<p>Adding this to AppHarbor is super-easy, start by selecting a logging configuration:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2015\/12\/image2-1-578x316.png\" alt=\"image2\" width=\"578\" height=\"316\" class=\"aligncenter size-large wp-image-2824\" \/><\/p>\n<p>Select the option to add a new log drain:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2015\/12\/image3-1-578x316.png\" alt=\"image3\" width=\"578\" height=\"316\" class=\"aligncenter size-large wp-image-2820\" \/><\/p>\n<p>Then, add the URL. This url needs to be in the format of &#8220;syslog:\/\/test.domain.com:9000&#8221;. If you use HTTP instead of &#8220;syslog&#8221;, you will get errors that say &#8220;(output buffer overflow)&#8221;, and lose all the useful data<sup><a href=\"#footnote_1_2818\" id=\"identifier_1_2818\" class=\"footnote-link footnote-identifier-link\" title=\"http:\/\/stackoverflow.com\/questions\/17532337\/error-l10-output-buffer-overflow-when-writing-to-splunk-drain\">2<\/a><\/sup><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2015\/12\/image4-1-578x316.png\" alt=\"image4\" width=\"578\" height=\"316\" class=\"aligncenter size-large wp-image-2821\" \/><\/p>\n<p>Once you finish, this is what you&#8217;ll see:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2015\/12\/image4-1-578x316.png\" alt=\"image4\" width=\"578\" height=\"316\" class=\"aligncenter size-large wp-image-2821\" \/><\/p>\n<p>And you should be all set.<\/p>\n<p>If you want to get the contents of these log messages into specific fields, I recommend the <a href=\"https:\/\/grokdebug.herokuapp.com\/\">grok debugger<\/a>.<\/p>\n<ol class=\"footnotes\"><li id=\"footnote_0_2818\" class=\"footnote\">https:\/\/support.appharbor.com\/kb\/tips-and-tricks\/application-server-ips-ec2-configuration<span class=\"footnote-back-link-wrapper\"> [<a href=\"#identifier_0_2818\" class=\"footnote-link footnote-back-link\">&#8617;<\/a>]<\/span><\/li><li id=\"footnote_1_2818\" class=\"footnote\">http:\/\/stackoverflow.com\/questions\/17532337\/error-l10-output-buffer-overflow-when-writing-to-splunk-drain<span class=\"footnote-back-link-wrapper\"> [<a href=\"#identifier_1_2818\" class=\"footnote-link footnote-back-link\">&#8617;<\/a>]<\/span><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>If you followed my previous post on setting up the ELK stack on Azure, you can configure AppHarbor to use it fairly easily. You need to open a port on Azure (I&#8217;ve chosen 9000). You can set the inbound IP range to AppHarbors IPs1. Once you do this, make a new file in \/etc\/logstash\/conf.d called &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/monitor-appharbor-with-the-elk-stack\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Monitor AppHarbor with the ELK Stack&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9,22,25],"tags":[56,74,169,330,344,347,370,522],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2818"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=2818"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2818\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=2818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=2818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=2818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}