{"id":4312,"date":"2019-08-09T14:08:25","date_gmt":"2019-08-09T10:08:25","guid":{"rendered":"https:\/\/nayarweb.com\/blog\/?p=4312"},"modified":"2019-08-09T14:08:25","modified_gmt":"2019-08-09T10:08:25","slug":"why-you-should-node-red-instead-of-java-based-logstash","status":"publish","type":"post","link":"https:\/\/nayarweb.com\/blog\/2019\/why-you-should-node-red-instead-of-java-based-logstash\/","title":{"rendered":"Why you should Node-RED instead of Java-based Logstash"},"content":{"rendered":"<h2>What is Logstash?<\/h2>\n<blockquote><p>Logstash is an open source, server-side data processing pipeline that ingests data from a multitude of sources simultaneously, transforms it, and then sends it to your favorite &#8220;stash.&#8221; &#8211; elastic<\/p><\/blockquote>\n<p><strong>In other words:<\/strong> Logstash is a software which can read data from multiple sources such as log files, tcp\/udp port, MySQL (via Plugin) and MQTT (via Plugin) and then transforms the data into a desired format such as JSON with some augmented attributes and then sends the data into mainly Elasticsearch.<\/p>\n<p><img decoding=\"async\" class=\"jsx-401670846 main-img\" src=\"https:\/\/images.contentstack.io\/v3\/assets\/bltefdd0b53724fa2ce\/blt48aca1f4f91f8ee7\/5d0ab511b0b16b1c530d26bc\/illustration-logstash-header.png\" alt=\"\" \/><\/p>\n<p>As you can see, Logstash is not given a complicated task to perform. All we expect from it is to stay alive and perform that task. But the setting up process and maintenance is such a pain. This reminds me of why I always refuse to use Java-based softwares.<\/p>\n<h2>Problem #1: Not starting with systemd inside an LXC container<\/h2>\n<p>No matter how much I tried, I never got it to start automatically with systemd. I had to open a screen session and then launch the process manually.<\/p>\n<p>Ofcourse, whenever Logstash would crash, it would not autostart. And if i were to reboot the VM, i&#8217;d have to launch the process manually.<\/p>\n<h2>Problem #2: Long boot time<\/h2>\n<p>If I were to kill Logstash and relaunch it, it takes around 100 &#8211; 120 seconds. It&#8217;s that heavy. You lose 2 minutes worth of data. I guess a C++ based program would have taken a maximum of 10 seconds to do a similar task. Avoid Java-based programs.<\/p>\n<p><a href=\"https:\/\/nayarweb.com\/blog\/2019\/why-you-should-node-red-instead-of-java-based-logstash\/screenshot_20190808_094818\/\" rel=\"attachment wp-att-4315\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4315\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190808_094818.png\" alt=\"\" width=\"753\" height=\"413\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190808_094818.png 753w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190808_094818-300x165.png 300w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/nayarweb.com\/blog\/2019\/why-you-should-node-red-instead-of-java-based-logstash\/screenshot_20190808_101905\/\" rel=\"attachment wp-att-4316\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4316\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190808_101905.png\" alt=\"\" width=\"613\" height=\"680\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190808_101905.png 613w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190808_101905-270x300.png 270w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<h2>Problem #3: Plugins (MQTT and MySQL)<\/h2>\n<p>If you want to use some other data sources or filters than provided, you&#8217;d have to compile the plugins yourself. When compiling the <a href=\"https:\/\/github.com\/logstash-plugins\/logstash-filter-jdbc_streaming\/issues\/27\">logstash-filter-jdbc_streaming<\/a> plugin, I had to downgrade the my Java version from 11 to 8 else Logstash wouldn&#8217;t start.<\/p>\n<p>And also the <a href=\"https:\/\/github.com\/jurek7\/logstash-input-mqtt\/issues\/13\">MQTT plugin<\/a> would stop working randomly and crash the whole Logstash process which is unacceptable!<\/p>\n<h2>Problem #4: RAM Usage<\/h2>\n<p>Logstash would let me compile plugins without minimum of 2GB of RAM. I have managed to run Elasticsearch on just 256 MB of RAM. Why is Logstash so hungry? I ain&#8217;t gonna feed it anymore. Enough is enough.<\/p>\n<h2>Hello Node-Red<\/h2>\n<p>Node-Red already has a built in MQTT node. I had to install the elastic plugin via the interface itself and voila! I have a working Logstash alternative. Stay tuned for more on Node-Red<\/p>\n<p><a href=\"https:\/\/nayarweb.com\/blog\/2019\/why-you-should-node-red-instead-of-java-based-logstash\/screenshot_20190809_140547\/\" rel=\"attachment wp-att-4323\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4323\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190809_140547.png\" alt=\"\" width=\"866\" height=\"220\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190809_140547.png 866w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190809_140547-300x76.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2019\/08\/Screenshot_20190809_140547-768x195.png 768w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Logstash? Logstash is an open source, server-side data processing pipeline that ingests data from a multitude of sources simultaneously, transforms it, and then sends it to your favorite &#8220;stash.&#8221; &#8211; elastic In other words: Logstash is a software which can read data from multiple sources such as log files, tcp\/udp port, MySQL (via &hellip; <a href=\"https:\/\/nayarweb.com\/blog\/2019\/why-you-should-node-red-instead-of-java-based-logstash\/\" class=\"continue-reading\">Continue reading <span class=\"screen-reader-text\">Why you should Node-RED instead of Java-based Logstash<\/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":[210],"tags":[225,232],"class_list":["post-4312","post","type-post","status-publish","format-standard","hentry","category-technology","tag-elasticsearch","tag-internet-of-things-iot"],"_links":{"self":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/4312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/comments?post=4312"}],"version-history":[{"count":6,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/4312\/revisions"}],"predecessor-version":[{"id":4326,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/4312\/revisions\/4326"}],"wp:attachment":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/media?parent=4312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/categories?post=4312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/tags?post=4312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}