{"id":352,"date":"2017-04-23T20:39:19","date_gmt":"2017-04-23T20:39:19","guid":{"rendered":"http:\/\/www.balajibandi.com\/?p=352"},"modified":"2024-02-18T16:13:15","modified_gmt":"2024-02-18T16:13:15","slug":"installing-and-configuring-syslog-ng-on-ubuntu-16-10-in-30min","status":"publish","type":"post","link":"https:\/\/www.balajibandi.com\/?p=352","title":{"rendered":"Installing and Configuring SYSLOG-NG on Ubuntu 16.10  in 30min."},"content":{"rendered":"<p>I have been thinking since long to setup a centralized log server for easy use and get alerts when the devices have warnings.<\/p>\n<p>I have done some logging servers before to monitor big network with 1000000 home users, but it was vert hard \u00a0to write scripts and automate them with perl and normalize to MySQL.<\/p>\n<p>After ELK the life become simple, and it is easy task and fast search, you can log anything and make available to search easy.<\/p>\n<p>So i have created a LAB setup with number of vendor devices like :<\/p>\n<p>Cisco Routers<\/p>\n<p>Cisco Switches<\/p>\n<p>Cisco Nexus<\/p>\n<p>Cisco ASA<\/p>\n<p>&#8212;Add vendors here<\/p>\n<p>Lets start with basic installation of \u00a0Ubuntu 16.10 .<\/p>\n<p>1. Requirements<\/p>\n<p>Download and install Ubuntu 16.10 server ISO from Ubunut site.<\/p>\n<p>Install ubunut following basic installation steps : \u00a0https:\/\/www.howtoforge.com\/ubuntu-14.10-utopic-unicorn-server<\/p>\n<p>Configuring Logstash to accept winlogbeats messages from windows 2012 R2 Server<\/p>\n<p>my beat.conf looks like below<\/p>\n<p>root@syslog:\/etc\/logstash\/conf.d# more beat.conf<br \/>input {<br \/>beats {<br \/>port =&gt; 5043<br \/>}<br \/>}<\/p>\n<p>output {<br \/>elasticsearch {<br \/>hosts =&gt; &#8220;192.168.1.67:9200&#8221;<br \/>manage_template =&gt; false<br \/>index =&gt; &#8220;%{[@metadata][beat]}-%{+YYYY.MMM.dd}&#8221;<br \/>document_type =&gt; &#8220;%{[@metadata][type]}&#8221;<br \/>}<br \/>}<\/p>\n<p>Save the conf file.<\/p>\n<p>Restart Logstash<\/p>\n<p># service logstash restart<\/p>\n<p>Login to Windows 2012 R2 Server and Test the connection.<\/p>\n<p id=\"TylODzN\"><img loading=\"lazy\" decoding=\"async\" width=\"798\" height=\"143\" class=\"alignnone size-full wp-image-369 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fd02c0210dd.png\" alt=\"\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fd02c0210dd.png 798w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fd02c0210dd-300x54.png 300w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fd02c0210dd-768x138.png 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/p>\n<p>Now Logstash listening on port 5043, let install winlogbeat on Windows 2012 R2 to ship the logs to Logstash.<\/p>\n<p><strong>winlogbeats installation and configuring<\/strong><\/p>\n<p>Download and extract winlogbeat from elasticsearch.co<\/p>\n<p>https:\/\/www.elastic.co\/downloads\/beats\/winlogbeat<\/p>\n<p>Extract on Desktop or desired folder<\/p>\n<p id=\"GfMZonY\"><img loading=\"lazy\" decoding=\"async\" width=\"687\" height=\"327\" class=\"alignnone size-full wp-image-360 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc455dd2a8b.png\" alt=\"\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc455dd2a8b.png 687w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc455dd2a8b-300x143.png 300w\" sizes=\"auto, (max-width: 687px) 100vw, 687px\" \/><\/p>\n<p>Edit winlogbeat.yml and modify basic steps to work with Logstash.<\/p>\n<p id=\"URCZEXt\"><img loading=\"lazy\" decoding=\"async\" width=\"307\" height=\"107\" class=\"alignnone size-full wp-image-361 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc459bb477d.png\" alt=\"\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc459bb477d.png 307w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc459bb477d-300x105.png 300w\" sizes=\"auto, (max-width: 307px) 100vw, 307px\" \/><\/p>\n<p id=\"fodGZIO\"><img loading=\"lazy\" decoding=\"async\" width=\"235\" height=\"40\" class=\"alignnone size-full wp-image-362 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc45f0b9b73.png\" alt=\"\" \/><\/p>\n<p id=\"MQnOSgM\"><img loading=\"lazy\" decoding=\"async\" width=\"248\" height=\"55\" class=\"alignnone size-full wp-image-363 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc460196858.png\" alt=\"\" \/><\/p>\n<p>Save the configuration file.<\/p>\n<p id=\"NzVcASa\"><strong>Testing and installing winlogbeat template with kibana<\/strong><\/p>\n<p><span class=\"pln\">PS C<\/span><span class=\"pun\">:<\/span><span class=\"pln\">\\Program <\/span><span class=\"typ\">Files<\/span><span class=\"pln\">\\Winlogbeat<\/span><span class=\"pun\">&gt;<\/span> <span class=\"typ\">Invoke<\/span><span class=\"pun\">&#8211;<\/span><span class=\"typ\">WebRequest<\/span> <span class=\"pun\">&#8211;<\/span><span class=\"typ\">Method<\/span> <span class=\"typ\">Put<\/span> <span class=\"pun\">&#8211;<\/span><span class=\"typ\">InFile<\/span><span class=\"pln\"> winlogbeat<\/span><span class=\"pun\">.<\/span><span class=\"pln\">template<\/span><span class=\"pun\">.<\/span><span class=\"pln\">json <\/span><span class=\"pun\">&#8211;<\/span><span class=\"typ\">Uri<\/span><span class=\"pln\"> http<\/span><span class=\"pun\">:\/\/192.168.1.67<\/span><span class=\"pun\">:<\/span><span class=\"lit\">9200<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">_template<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">winlogbeat<\/span><span class=\"pun\">?<\/span><span class=\"pln\">pretty <\/span><span class=\"pun\">&#8211;<\/span><span class=\"typ\">ContentType<\/span><span class=\"pln\"> application<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">json<\/span><\/p>\n<p id=\"wrpDtwj\"><img loading=\"lazy\" decoding=\"async\" width=\"852\" height=\"324\" class=\"alignnone size-full wp-image-358 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc4410f1a6e.png\" alt=\"\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc4410f1a6e.png 852w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc4410f1a6e-300x114.png 300w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc4410f1a6e-768x292.png 768w\" sizes=\"auto, (max-width: 852px) 100vw, 852px\" \/><\/p>\n<p>Now the template is registered and working.<\/p>\n<p>Now using powershall script make winlogbeat as services.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"586\" height=\"71\" class=\"alignnone size-full wp-image-365 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc46d57f36a.png\" alt=\"\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc46d57f36a.png 586w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc46d57f36a-300x36.png 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n<p>Once above steps successfully you can start the services by manually or go in to services and start winlogbeat service.<\/p>\n<p id=\"cCpzhOQ\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"24\" class=\"alignnone size-full wp-image-366 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc47674ca1c.png\" alt=\"\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc47674ca1c.png 508w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc47674ca1c-300x14.png 300w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/p>\n<p>Now the Service up and running, lets check the winlogbeats shipping the logs to logstash.<\/p>\n<p>(make sure in Logstash server \/usr\/share\/logstash read and writable by logstash user (or any other user if you using different than default).<\/p>\n<p>PS C:\\Users\\Administrator\\Desktop\\winlogbeat-5.3.1-windows-x86_64&gt; Get-Content .\\logs\\winlogbeat -Wait<\/p>\n<p>You can see now the data shipping to Logstash we have setup on port 5043<\/p>\n<p id=\"mrTlKJN\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"84\" class=\"alignnone size-full wp-image-367 \" src=\"http:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc48145f13d.png\" alt=\"\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc48145f13d.png 849w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc48145f13d-300x30.png 300w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2017\/04\/img_58fc48145f13d-768x76.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/p>\n\n\n<p class=\"wp-block-paragraph\">Happy Labbing !!!!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been thinking since long to setup a centralized log server for easy use and get alerts when the devices have warnings. I have done some logging servers before to monitor big network with 1000000 home users, but it was vert hard \u00a0to write scripts and automate them with perl and normalize to MySQL. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,6],"tags":[],"class_list":["post-352","post","type-post","status-publish","format-standard","hentry","category-linux","category-security"],"_links":{"self":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=352"}],"version-history":[{"count":12,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/352\/revisions"}],"predecessor-version":[{"id":2086,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/352\/revisions\/2086"}],"wp:attachment":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}