<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: juniper dew</title>
    <description>The latest articles on DEV Community by juniper dew (@juni_dew).</description>
    <link>https://dev.to/juni_dew</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1097659%2F91ca5302-f18e-420f-ac3f-7120ea1d43ba.jpg</url>
      <title>DEV Community: juniper dew</title>
      <link>https://dev.to/juni_dew</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/juni_dew"/>
    <language>en</language>
    <item>
      <title>Setting up a single Splunk Forwarder to send different data to multiple indexes</title>
      <dc:creator>juniper dew</dc:creator>
      <pubDate>Thu, 08 Jun 2023 08:47:46 +0000</pubDate>
      <link>https://dev.to/juni_dew/setting-up-a-single-splunk-forwarder-to-send-different-data-to-multiple-indexes-55e7</link>
      <guid>https://dev.to/juni_dew/setting-up-a-single-splunk-forwarder-to-send-different-data-to-multiple-indexes-55e7</guid>
      <description>&lt;h3&gt;
  
  
  Pre-requisites:
&lt;/h3&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 &lt;a href="https://hurricanelabs.com/splunk-tutorials/your-all-in-one-guide-to-setting-up-pfsense-and-suricata-in-splunk/"&gt;here&lt;/a&gt;, 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;&lt;strong&gt;Note:&lt;/strong&gt; There are some steps specific to my use case, which are marked accordingly with &lt;strong&gt;[OPT].&lt;/strong&gt; These can be ignored if just trying to configure a universal forwarder to send data to multiple indexes in Splunk.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Steps:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create the desired index in Splunk (Settings --&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;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cQWI8nuW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwz5f1mtxvfvj27yyo8p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cQWI8nuW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwz5f1mtxvfvj27yyo8p.png" alt="Image description" width="800" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6AXtzYPj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfznr0gbztt5h8c2qz32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6AXtzYPj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfznr0gbztt5h8c2qz32.png" alt="Image description" width="800" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;[OPT]&lt;/em&gt;&lt;/strong&gt; Go to pfsense web UI, and create &amp;amp; configure the instance that you want to monitor. Once up and running, go to 'Logs View' and select the instance to view.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a81P1_7B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1674202427414/c05ed6d0-aba7-4be3-bd8b-c790429611cc.png%2520align%3D%2522center%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a81P1_7B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1674202427414/c05ed6d0-aba7-4be3-bd8b-c790429611cc.png%2520align%3D%2522center%2522" alt="" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note the file path and importantly, the folder name where logs are sent for that instance. Mine 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;ol&gt;
&lt;li&gt;SSH into your VM/machine with the splunk forwarder installed and modify the &lt;code&gt;inputs.conf&lt;/code&gt; file. In my case it's found in &lt;code&gt;/opt/splunkforwarder/etc/apps/TA-Suricata/default&lt;/code&gt;, but that's because I'm using the &lt;a href="https://splunkbase.splunk.com/app/2760"&gt;TA-Suricata&lt;/a&gt; app to make my Suricata logs Splunk-readable (matching Splunk's Common Information Model [CIM]).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GlJhiLGZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zm2hy8d2ia6lnzt7gzmk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GlJhiLGZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zm2hy8d2ia6lnzt7gzmk.png" alt="Image description" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f0a6QHXx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9jiok8fj6umryobitz4x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f0a6QHXx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9jiok8fj6umryobitz4x.png" alt="Image description" width="800" height="387"&gt;&lt;/a&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 &lt;code&gt;inputs.conf&lt;/code&gt; file if there isn't already one. This overrides all of the defaults located in &lt;code&gt;/opt/splunkforwarder/etc/system/default&lt;/code&gt;, and it's &lt;a href="https://docs.splunk.com/Documentation/Splunk/9.0.3/Data/Monitorfilesanddirectorieswithinputs.conf#:~:text=The%20inputs.,a%20stanza%20to%20the%20inputs."&gt;best practice&lt;/a&gt; to modify files within &lt;code&gt;/local&lt;/code&gt; instead when you're not using an extra app like I am.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VgHS9lVp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7453qsy2tmrxahbulgw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VgHS9lVp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7453qsy2tmrxahbulgw.png" alt="Image description" width="692" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&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;).
Additionally, set &lt;code&gt;index = ids_lan&lt;/code&gt; , or whatever index you created in Step 1.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hvwXBNkZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2oopvb2hawyezhvddkxi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hvwXBNkZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2oopvb2hawyezhvddkxi.png" alt="Image description" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a more general installation, here is some sample code (excluding suricata-specific options).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Code Dump:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\[monitor://&amp;lt;mark&amp;gt;path_to_your_monitored_file_here&amp;lt;/mark&amp;gt;\]&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 = &amp;lt;mark&amp;gt;your_index_from_step_1&amp;lt;/mark&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;host = &amp;lt;mark&amp;gt;your_splunk_instance_name&amp;lt;/mark&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;(Your splunk instance name is found by going to&lt;/em&gt; &lt;strong&gt;&lt;em&gt;Settings --&amp;gt; Server Settings --&amp;gt; General Settings&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;in the splunk web UI&lt;/em&gt;&lt;strong&gt;&lt;em&gt;)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&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;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nxDZaE5P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/64ogn4btvhqukowrwgwf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nxDZaE5P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/64ogn4btvhqukowrwgwf.png" alt="Image description" width="800" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&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'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;em&gt;Log Contents&lt;/em&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="your_index_from_step_1"&lt;/code&gt; . Check the time stamp matches when you expect the last log to have been from, and voila!&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zbFKmINs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3plyzn1hjmed0g59iw3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zbFKmINs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3plyzn1hjmed0g59iw3.png" alt="Image description" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  💛 Best of luck, I hope this helps some people and avoids too much keyboard-bashing! 💛
&lt;/h3&gt;

</description>
      <category>splunk</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>pfsense</category>
    </item>
  </channel>
</rss>
