<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Splunk on juni&#39;s blog ٩(◕‿◕｡)۶</title>
    <link>/categories/splunk/</link>
    <description>Recent content in Splunk on juni&#39;s blog ٩(◕‿◕｡)۶</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Mon, 23 Jan 2023 00:00:00 +0000</lastBuildDate><atom:link href="/categories/splunk/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Splunk Forwarders with Multiple Indexes</title>
      <link>/posts/0/splunk-forwarder/</link>
      <pubDate>Mon, 23 Jan 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/0/splunk-forwarder/</guid>
      <description>&lt;h2 id=&#34;--pre-requisites&#34;&gt;- Pre-requisites:&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Have a working Splunk instance (Splunk Enterprise, in my case) to connect to. There are plenty of tuts for this online.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Have installed a universal forwarder on the endpoint that you want to monitor (see here, an excellent post which will get you most of the way through setting up Splunk to analyse Suricata &amp;amp; pfSense logs)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: There are some steps specific to my use case, which are marked accordingly with &lt;em&gt;&lt;strong&gt;[OPTIONAL]&lt;/strong&gt;&lt;/em&gt;. These can be ignored if you&amp;rsquo;re just trying to configure a universal forwarder to send data to multiple indexes in Splunk.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;--detailed-steps&#34;&gt;- Detailed Steps:&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create the desired index in Splunk (Settings &amp;ndash;&amp;gt; Indexes). I named mine &lt;code&gt;ids_lan&lt;/code&gt; as I am using an Intrusion Detection System (IDS) to monitor my LAN network on pfSense. You can leave all the index settings as default for now.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674202112483/cce019ab-74e4-4018-b49c-e329f0b52e60.png&#34; alt=&#34;Indexes&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674202139846/a4d02e8f-7c8b-4155-9d19-571085ee88b4.png&#34; alt=&#34;index name ids_lan&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;[OPTIONAL]&lt;/strong&gt;&lt;/em&gt; Go to pfsense web UI, and create &amp;amp; configure the instance that you want to monitor. Once up and running, go to &amp;lsquo;Logs View&amp;rsquo; and select the instance to view.&lt;br&gt;
&lt;img src=&#34;../../posts/0/splunk3.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674202427414/c05ed6d0-aba7-4be3-bd8b-c790429611cc.png?auto=compress,format&amp;amp;format=webp&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Note the file path and importantly, the folder name where logs are sent for that instance. My path is &lt;code&gt;/var/log/suricata/suricata_em125470/eve.json&lt;/code&gt; and the folder name is &lt;code&gt;suricata_em125470&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SSH into your VM/machine with the splunk forwarder installed and modify the inputs.conf file. In my case it&amp;rsquo;s found in &lt;code&gt;/opt/splunkforwarder/etc/apps/TA-Suricata/default&lt;/code&gt;, but that&amp;rsquo;s because I&amp;rsquo;m using the &lt;a href=&#34;https://splunkbase.splunk.com/app/2760&#34;&gt;&lt;strong&gt;TA-Suricata&lt;/strong&gt;&lt;/a&gt; app to make my Suricata logs Splunk-readable (matching Splunk&amp;rsquo;s Common Information Model [CIM]).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674202463423/f0338623-9179-4154-afab-6eff2dfe8af1.png?auto=compress,format&amp;amp;format=webp&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;In most cases, you should navigate to &lt;code&gt;/opt/splunkforwarder/etc/system/local&lt;/code&gt; and create an inputs.conf file if there isn&amp;rsquo;t already one. This overrides all of the defaults located in &lt;code&gt;/opt/splunkforwarder/etc/system/default&lt;/code&gt;, and it&amp;rsquo;s &lt;a href=&#34;https://docs.splunk.com/Documentation/Splunk/9.0.3/Data/Monitorfilesanddirectorieswithinputs.conf#:~:text=The%20inputs.,a%20stanza%20to%20the%20inputs.&#34;&gt;&lt;strong&gt;best practice&lt;/strong&gt;&lt;/a&gt; to modify files within &lt;code&gt;/local&lt;/code&gt; instead when you&amp;rsquo;re not using an extra app like I am.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674202812915/47e63a91-6b6b-48f3-9a94-f163b7de5b19.png?auto=compress,format&amp;amp;format=webp&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Within the &lt;code&gt;inputs.conf&lt;/code&gt; file, create entries like so (as many as needed), making sure to reference the new folder that was created in step 3 (&lt;code&gt;suricata_em125470&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674203175586/f3a9904a-2e33-4b61-b964-fd9207851993.png?auto=compress,format&amp;amp;format=webp&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Additionally, set &lt;code&gt;index = ids_lan&lt;/code&gt; , or whatever index you created in Step 1.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;~&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;For a more general installation, here is some sample code (excluding suricata-specific options).&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;--code-dump&#34;&gt;- Code Dump:&lt;/h2&gt;
&lt;hr&gt;
&lt;p&gt;&lt;code&gt;[monitor://path_to_your_monitored_file_here]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;disabled = false&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;index = your_index_from_step_1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;host = your_splunk_instance_name&lt;/code&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Your splunk instance name is found by going to &lt;code&gt;Settings --&amp;gt; Server Settings --&amp;gt; General Settings&lt;/code&gt; in the splunk web UI)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Navigate to the &lt;code&gt;/opt/splunkforwarder/bin/&lt;/code&gt; directory and run the command &lt;code&gt;./splunk restart&lt;/code&gt; to restart the splunk forwarder. &lt;strong&gt;A reboot of the system is (likely) not sufficient.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674203970829/b7c520ae-14df-4fdb-910c-2668fc8ac35f.png?auto=compress,format&amp;amp;format=webp&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Upon restarting, within the same directory (&lt;code&gt;/opt/splunkforwarder/bin/&lt;/code&gt;) check that Splunk is running with &lt;code&gt;./splunk status&lt;/code&gt;. If it isn&amp;rsquo;t, run &lt;code&gt;./splunk start&lt;/code&gt;. Verify there are logs in the folder you just linked to (in my case, &lt;code&gt;suricata_em125470&lt;/code&gt;), which can be done either by navigating to the path where they are stored, or in my use case, via &lt;code&gt;Log Contents&lt;/code&gt; in the pfSense web UI (see step 3).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Wait a few minutes or so, and then run a splunk search for a timeframe for which you know there are log entries for, with something like &lt;code&gt;index=&amp;quot;your_index_from_step_1&amp;quot;&lt;/code&gt; . Check the time stamp matches when you expect the last log to have been from, and voila!&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://cdn.hashnode.com/res/hashnode/image/upload/v1674204285133/70586cb2-a6d8-4ae9-8273-01f5add4dc02.png?auto=compress,format&amp;amp;format=webp&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;💛 &lt;em&gt;&lt;strong&gt;Best of luck, I hope this helps some people and avoids too much keyboard-bashing!&lt;/strong&gt;&lt;/em&gt; 💛&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; &lt;em&gt;I would consider this a LEGACY POST of mine, written a long time ago. Please excuse any typos, errors or lapses in memory/judgement - as it was added to the site from the archives, just to put everything in one place. Thankq for your understanding 🙇‍♀️&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
</description>
    </item>
    
  </channel>
</rss>
