{"id":251,"date":"2023-03-17T15:34:06","date_gmt":"2023-03-17T15:34:06","guid":{"rendered":"https:\/\/blog.lottabytes.com\/?p=251"},"modified":"2025-02-07T20:41:09","modified_gmt":"2025-02-07T20:41:09","slug":"ingesting-external-logs-via-security-onions-elasticsearch","status":"publish","type":"post","link":"https:\/\/blog.lottabytes.com\/index.php\/2023\/03\/17\/ingesting-external-logs-via-security-onions-elasticsearch\/","title":{"rendered":"Ingesting External Logs via Security Onion&#8217;s Elasticsearch"},"content":{"rendered":"\n<p>So, you&#8217;ve got Security Onion (SO) running from the <a href=\"https:\/\/blog.lottabytes.com\/index.php\/2022\/10\/25\/security-appliance-in-a-box-via-ansible\/\" data-type=\"post\" data-id=\"184\">Security-Appliance-in-a-Box via Ansible<\/a>.  Now what?  How do you begin to ingest logs from your other devices into the included Elastic instance?  I&#8217;m glad you asked!  There&#8217;s a couple steps you&#8217;ll need to follow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Allow Access<\/h2>\n\n\n\n<p>First you&#8217;re going to need to open the firewall to allow incoming TCP traffic to port 9200.  You can limit it by host\/subnet, or just open it to all using the below.<\/p>\n\n\n\n<p>For the 2.4 version, you can do this via the Administration &gt; Configuration, but need to enable the advanced settings.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"685\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/elasticsearch_rest_firewall-1024x685.png\" alt=\"\" class=\"wp-image-345\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/elasticsearch_rest_firewall-1024x685.png 1024w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/elasticsearch_rest_firewall-300x201.png 300w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/elasticsearch_rest_firewall-768x514.png 768w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/elasticsearch_rest_firewall.png 1170w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>On the legacy version you do this as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --permanent --add-port=9200\/tcp<\/code><\/pre>\n\n\n\n<p>On legacy versions, you&#8217;ll also need to authorize the subnet\/host with SO (using the so-allow command) to use the Elasticsearch REST API.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"302\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_085629.png\" alt=\"\" class=\"wp-image-256\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_085629.png 650w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_085629-300x139.png 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Configure Elasticsearch<\/h2>\n\n\n\n<p>There&#8217;s a couple things that need to be done to allow ingestion, as well as viewing your data. The first is to <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/privileges-to-publish-events.html\">create a role for publishing events<\/a>. I&#8217;ve granted it the below privileges, which include the ability to create indexes. This is the minimum set of requirements that I&#8217;ve found, removal of any will prevent the ability to send logs.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"409\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/image-1024x409.png\" alt=\"\" class=\"wp-image-347\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/image-1024x409.png 1024w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/image-300x120.png 300w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/image-768x307.png 768w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/image.png 1221w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Next, you&#8217;ll need to create a user that your agents will use.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"481\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084546-1024x481.png\" alt=\"\" class=\"wp-image-253\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084546-1024x481.png 1024w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084546-300x141.png 300w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084546-768x361.png 768w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084546-1536x722.png 1536w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084546.png 1598w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"> <\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Data Views and Indices<\/h2>\n\n\n\n<p>By default, you won&#8217;t see filebeat as a dataview, which isn&#8217;t useful as you can&#8217;t see your incoming logs. To remedy that situation, click on the <em>Create a data view<\/em> button. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"284\" height=\"522\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084657.png\" alt=\"\" class=\"wp-image-254\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084657.png 284w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084657-163x300.png 163w\" sizes=\"auto, (max-width: 284px) 100vw, 284px\" \/><\/figure>\n\n\n\n<p>Using <em>filebeat-*<\/em> as both the Name and Index Pattern, you should see that you have a source already mapped. If you don&#8217;t see that, it&#8217;s probably because your agents aren&#8217;t sending logs yet.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"690\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084759-1024x690.png\" alt=\"\" class=\"wp-image-255\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084759-1024x690.png 1024w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084759-300x202.png 300w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084759-768x518.png 768w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084759-1536x1035.png 1536w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_084759.png 1598w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Agent Configuration<\/h2>\n\n\n\n<p>There&#8217;s already <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/filebeat-installation-configuration.html\">good documentation around installing the Filebeat Agent<\/a>, so I won&#8217;t cover that except to note that this<a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/configuration-ssl.html#ssl-client-config\"> docs page<\/a> is important for SSL settings as HTTPS is the default.  After that, I do want to call out that you need to go into the appropriate module (e.g., nginx) configuration, otherwise you won&#8217;t see logs, even after enabling the module.<\/p>\n\n\n\n<p>Example: I want to collect nginx logs.<\/p>\n\n\n\n<p>Step 1: Update the nginx module configuration, located at \/etc\/filebeat\/modules.d\/nginx.yml.  Mark sections (e.g., access vs. error) as enabled.  Provide path details to the files as required.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"691\" height=\"259\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_093020.png\" alt=\"\" class=\"wp-image-258\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_093020.png 691w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/03\/Screenshot_20230317_093020-300x112.png 300w\" sizes=\"auto, (max-width: 691px) 100vw, 691px\" \/><\/figure>\n\n\n\n<p>Finally, enable the module:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo filebeat modules enable nginx<\/code><\/pre>\n\n\n\n<p>There you have it.  Now your SO appliance is beginning to ingest log data from your remote hosts.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"523\" src=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/11\/Log-Ingestion-Dashboard-1024x523.png\" alt=\"\" class=\"wp-image-288\" srcset=\"https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/11\/Log-Ingestion-Dashboard-1024x523.png 1024w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/11\/Log-Ingestion-Dashboard-300x153.png 300w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/11\/Log-Ingestion-Dashboard-768x392.png 768w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/11\/Log-Ingestion-Dashboard-1536x785.png 1536w, https:\/\/blog.lottabytes.com\/wp-content\/uploads\/2023\/11\/Log-Ingestion-Dashboard.png 1601w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>So, you&#8217;ve got Security Onion (SO) running from the Security-Appliance-in-a-Box via Ansible. Now what? How do you begin to ingest logs from your other devices into the included Elastic instance? I&#8217;m glad you asked! There&#8217;s a couple steps you&#8217;ll need to follow. Allow Access First you&#8217;re going to need to open the firewall to allow &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.lottabytes.com\/index.php\/2023\/03\/17\/ingesting-external-logs-via-security-onions-elasticsearch\/\" class=\"more-link\">Read more<span class=\"screen-reader-text\"> &#8220;Ingesting External Logs via Security Onion&#8217;s Elasticsearch&#8221;<\/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":[1],"tags":[69,68,53,54,51],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-elasticsearch","tag-nginx","tag-security","tag-security-appliance","tag-security-onion"],"_links":{"self":[{"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/comments?post=251"}],"version-history":[{"count":9,"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions\/349"}],"wp:attachment":[{"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/media?parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/categories?post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lottabytes.com\/index.php\/wp-json\/wp\/v2\/tags?post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}