<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[The Splunkist]]></title><description><![CDATA[The Splunkist]]></description><link>https://splunkist.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1632175695926/q4lR0xvhW.png</url><title>The Splunkist</title><link>https://splunkist.com</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 16:42:38 GMT</lastBuildDate><atom:link href="https://splunkist.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Splunk | collect, part 2]]></title><description><![CDATA[Every precaution should be taken to onboard data correctly; nevertheless, there are several instances where it might be necessary to move data from one index to another.  When a Splunk admin has access to the file system entire Splunk indexes can be ...]]></description><link>https://splunkist.com/splunk-collect-part-2</link><guid isPermaLink="true">https://splunkist.com/splunk-collect-part-2</guid><dc:creator><![CDATA[Aaron White]]></dc:creator><pubDate>Wed, 13 Oct 2021 11:59:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628697703648/t-IIHGKwU.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Every precaution should be taken to onboard data correctly; nevertheless, there are several instances where it might be necessary to move data from one index to another.  When a Splunk admin has access to the file system entire Splunk indexes can be moved, migrated, or copied around with relative ease; however, in the scenario where you are a Splunk Cloud customer or perhaps only need to copy a subset of data from one index to another then using the <strong>collect</strong> command might be your best option.</p>
<p>In this hypothetical scenario the Splunk admin misspelled the <strong>dragos</strong> index as <strong>dargos</strong>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628697301218/lZgVRZGhJ.jpeg" alt="dargos_search.JPG" /></p>
<p>Let's use the <strong>collect</strong> command to help this Splunk admin out.<br /><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628697397615/1DMwnt4bB.jpeg" alt="collect.JPG" /></p>
<pre><code><span class="hljs-keyword">index</span>=dargos sourcetype=dragos_alert source=dragos_alerts
| collect <span class="hljs-keyword">index</span>=dragos sourcetype=dragos_alert source=dragos_alerts
</code></pre><p>Now the data has been moved to the <strong>dragos</strong> index and can be searched:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628697576902/Dl2VCMjZR.jpeg" alt="dragos_source_sourcetype.JPG" /></p>
<h3 id="what-about-my-old-data">What about my old data?</h3>
<h4 id="you-have-several-options">You have several options:</h4>
<ul>
<li>Delete the old index</li>
<li>Adjust the <strong>Searchable time (days)</strong> setting to 1 day and wait for your data to age out.  You can find this setting under <strong>Settings</strong> --&gt; <strong>Indexes</strong> --&gt; select <strong>Edit</strong> next to your chosen index</li>
<li>Use the <strong>delete</strong> command<ul>
<li>A note about the <strong>delete</strong> command: a user must have the <strong>delete_by_keyword</strong> capability and by default no Splunk role has this capability--not even the <strong>admin</strong> role.  Also, the <strong>delete</strong> command does not reclaim disk space; rather, it makes the data unsearchable.  To learn more about the <strong>delete</strong> command check out the  <a target="_blank" href="https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Delete">Splunk docs</a>.</li>
</ul>
</li>
</ul>
<h2 id="move-a-subset-of-data">Move a subset of data</h2>
<p>What if I don't want to move the entire index, but just a subset of data from an index?  The collect command can be used in this scenario as well.  In this scenario we will take the <strong>WinEventLog:Security</strong> events and copy them from the <strong>windows</strong> index into their own index called <strong>oswinsec</strong>.</p>
<p><strong>NOTE:</strong> Before copying data into the new index, adjust your <strong>WinEventLog:Security</strong> inputs in <strong>Splunk_TA_windows/local/inputs.conf</strong> to include the updated index to ensure all new data goes to the new index.</p>
<pre><code><span class="hljs-comment"># Splunk_TA_windows/local/inputs.conf</span>
<span class="hljs-section">[WinEventLog://Security]</span>
<span class="hljs-attr">index</span> = oswinsec
<span class="hljs-attr">disabled</span> = <span class="hljs-number">0</span>
</code></pre><p>Once you've identified the events that you would like to move and have selected the appropriate time range you are ready to pipe your search to <strong>collect</strong>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628785605418/xnKAgtcpJ.jpeg" alt="collect.JPG" /></p>
<pre><code><span class="hljs-keyword">index</span>=windows sourcetype=WinEventLog source="WinEventLog:Security"
| collect <span class="hljs-keyword">index</span>=oswinsec sourcetype=WinEventLog source="WinEventLog:Security"
</code></pre><p>Now you can search your data in the new index:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628785643738/d44wa3Kho.jpeg" alt="search.JPG" /></p>
<p>Segregating your operation logs from your security logs can be beneficial if you have different access or storage retention requirements.  For example, you could limit access to the <strong>oswinsec</strong> index to just your security team and configure a 1-year retention on the <strong>oswinsec</strong> index, and configure a 60-day retention on your operational indexes while allowing everyone the ability to search the operational indexes.</p>
<h3 id="what-about-my-old-data">What about my old data?</h3>
<p>Assuming you don't want to wait for the old data to age out the only viable option in this scenario is to use the <strong>delete</strong> command.</p>
<h3 id="a-note-about-license-usage">A note about license usage</h3>
<p>When using the collect command if no <em>sourcetype</em> is specified then it defaults to “stash”.  The benefit of using the “stash” <em>sourcetype</em> is the data collected does not count against your license usage.  However, that is not feasible in our scenarios as it is necessary to specify a <em>sourcetype</em> and as a result additional license usage will be incurred for ingest based licenses.  Depending on your licensing model this may or may not be of concern, but it is best to be aware of the implications.  Check out Splunk Cloud's <a target="_blank" href="https://docs.splunk.com/Documentation/SplunkCloud/latest/Service/SplunkCloudservice#Data_policies">Data Policies</a>  or refer to your terms and conditions.</p>
<h4 id="additional-resources">Additional Resources:</h4>
<p><a target="_blank" href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Collect">Splunk Docs on collect</a></p>
]]></content:encoded></item><item><title><![CDATA[Splunk | collect, part 1]]></title><description><![CDATA[Perhaps you've recently moved your Splunk stack to the cloud and are wondering how you can enrich Splunk your queries with user information from Active Directory.  If this is you follow along as I will show you how to configure the Splunk Supporting ...]]></description><link>https://splunkist.com/splunk-collect-part-1</link><guid isPermaLink="true">https://splunkist.com/splunk-collect-part-1</guid><dc:creator><![CDATA[Aaron White]]></dc:creator><pubDate>Mon, 20 Sep 2021 21:46:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1627662749182/2Ab7Po6Z1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Perhaps you've recently moved your Splunk stack to the cloud and are wondering how you can enrich Splunk your queries with user information from Active Directory.  If this is you follow along as I will show you how to configure the Splunk Supporting Add-on for Active Directory and index your LDAP queries in Splunk cloud.</p>
<h4 id="prerequisites">Prerequisites</h4>
<ul>
<li>A Splunk instance hosted in the cloud</li>
<li>A Splunk Heavy Forwarder on-prem that has access to your Domain Controller</li>
<li>Firewall ports opened between your Heavy Forwarder and Domain Controller on 389/636</li>
<li>An index – if you are not using an existing index then you will need to create an index for this purpose</li>
<li>Splunk Supporting Add-on for Active Directory</li>
</ul>
<h4 id="assumptions">Assumptions:</h4>
<p>It is assumed that you already have a Splunk Heavy Forwarder configured and forwarding data to Splunk cloud.</p>
<h3 id="splunk-supporting-add-on-for-active-directory">Splunk Supporting Add-on for Active Directory</h3>
<h4 id="install-splunk-supporting-add-on-for-active-directory">Install Splunk Supporting Add-on for Active Directory</h4>
<ol>
<li>If you haven’t already, download the  <a target="_blank" href="https://splunkbase.splunk.com/app/1151/">Splunk Supporting Add-on for Active Directory </a> from Splunkbase.</li>
<li>From the Splunk Web home screen of your Splunk Heavy Forwarder, click the gear icon next to <strong>Apps</strong>.</li>
<li>Click the <strong>Install app from file</strong> button.</li>
<li>On the upload screen locate the downloaded file and click <strong>Upload</strong>.</li>
<li>Restart Splunk when prompted.</li>
</ol>
<h4 id="configure-splunk-supporting-add-on-for-active-directory">Configure Splunk Supporting Add-on for Active Directory</h4>
<ol>
<li>Navigate to <strong>Apps</strong> and select <strong>Splunk Supporting Add-on for Active Directory</strong>.</li>
<li>Select the <strong>Configuration</strong> menu.</li>
<li><p>Configure the <strong>default</strong> domain:</p>
<ol>
<li><p>In the <strong>Alternate domain name</strong> field, type in an alternate representation of the domain in NetBIOS format. Make sure that the alternate domain name is specified in UPPERCASE format.</p>
<p><code>Example: SPLUNKU</code> </p>
</li>
<li><p>In the <strong>Base DN</strong> field, type in LDAP notation, the starting point to use when searching for users.</p>
<p><code>Example: OU=Domain Users,DC=splunku,DC=com</code> </p>
</li>
<li>In the <strong>LDAP Server: Hostname</strong> field, type in the name or IP address of the host that the add-on should connect to for this domain.</li>
<li>In the <strong>LDAP Server: Port</strong> field, type in the port that the add-on should connect to on the LDAP server.</li>
<li>If you want the server to use SSL to connect, click the <strong>SSL</strong> checkbox.</li>
<li><p>In the <strong>Credentials: Bind DN</strong> field, enter the username that the add-on should use to connect to the LDAP server you specified previously, in LDAP notation.</p>
<p><code>Example: CN=Splunk LDAP,CN=Users,DC=splunku,DC=com</code> </p>
</li>
<li>In the <strong>Credentials: Password</strong> field, enter the password for that user.</li>
<li>Click the <strong>Test connection</strong> button to verify your settings.</li>
<li>Click <strong>Save</strong> to save your changes.</li>
</ol>
</li>
</ol>
<p>When completed your settings should look similar to this:
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627338428889/EphCtvAhb.png" alt="ldap_config_edit.png" /></p>
<h4 id="craft-your-ldap-query">Craft your LDAP query</h4>
<p>Navigate to search and begin crafting your desired LDAP query:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627425781364/VLPUWB25F.jpeg" alt="ldap_search.jpg" /></p>
<pre><code>| ldapsearch <span class="hljs-keyword">search</span>="(&amp;(samAccountType=805306368))" attrs="accountExpires, co, department, displayName, distinguishedName, givenName, l, mail, mobile, manager, memberOf, personalTitle, sAMAccountName, sn, st, telephoneNumber, userAccountControl, whenCreated"
</code></pre><h3 id="collect">Collect</h3>
<p>Now pipe your results to <strong>collect</strong> and provide the desired index:</p>
<pre><code>| collect <span class="hljs-keyword">index</span>=ldap
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627426002250/pWXXO6bSr.jpeg" alt="ldap_collect.jpg" /></p>
<h4 id="save-and-schedule-your-search">Save and schedule your search:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627682077886/edYnuH2KvK.gif" alt="schedule.gif" /></p>
<h3 id="search-your-data">Search your data</h3>
<p>From your Splunk Cloud search head you can now search the <strong>ldap</strong> index and should see the same events that were generated from the saved search on the Splunk Heavy Forwarder:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627426684621/MQPMVOOq6.jpeg" alt="search.jpg" /></p>
<h4 id="or-spath">| spath</h4>
<p>You'll notice the indexed events are in JSON format and the fields are not extracted.  Use the <strong>spath</strong> command with no arguments, this puts the spath command in "auto-extract" mode which will find and extract all the fields:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627426797310/ASV8z_HiN.jpeg" alt="spath.jpg" /></p>
<hr />
<h4 id="a-note-about-spath-sourcetypes-and-license-usage">A note about <em>spath</em>, <em>sourcetypes</em>, and <em>license usage</em></h4>
<p>When using the <strong>collect</strong> command if no <em>sourcetype</em> is specified then it defaults to “stash”.  The benefit of using the “stash” <em>sourcetype</em> is the data collected does not count against your license usage.  When specifying a <em>sourcetype </em>outside of “stash” you will incur license usage.
Additionally, when using the “stash” <em>sourcetype</em> for our JSON data the fields are no longer auto extracted.  Using “spath” is a quick and easy way to solve this problem at search time; nevertheless, there are other solutions you may wish to consider.  One such option is specifying the <em>sourcetype</em> of “json_no_timestamp” when running collect :</p>
<pre><code>| collect <span class="hljs-keyword">index</span>=ldap sourcetype=json_no_timestamp
</code></pre><p>This properly extracts the fields without any additional work when searching the data; however, the data will count against your license usage.  The amount and frequency of data collected will factor into what method to use.</p>
<hr />
<h4 id="formatting-and-outputting">Formatting and outputting</h4>
<p>Finally, you can format the data and output it to a lookup table for use in future searches:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1627427191987/E4-9nr9v4.jpeg" alt="format.JPG" /></p>
<pre><code><span class="hljs-keyword">index</span>=ldap 
| spath 
| rex field=memberOf <span class="hljs-string">"CN=(?&lt;mof_parsed&gt;[^,]+)"</span> 
| rex max_match=<span class="hljs-number">5</span> field=distinguishedName <span class="hljs-string">"OU=(?&lt;dn_parsed&gt;[^,]+)"</span> 
| <span class="hljs-keyword">eval</span> memberOf=lower(replace(mvjoin(mof_parsed, <span class="hljs-string">"|"</span>), <span class="hljs-string">" "</span>, <span class="hljs-string">"_"</span>)), category=lower(replace(mvjoin(dn_parsed, <span class="hljs-string">"|"</span>), <span class="hljs-string">" "</span>, <span class="hljs-string">"_"</span>)), priority=case(match(category, <span class="hljs-string">"domain_admin|disabled|hold|executive"</span>) OR match(memberOf, <span class="hljs-string">"domain_admin|enterprise_admin|schema_admin|administrator"</span>), <span class="hljs-string">"critical"</span>, match(category, <span class="hljs-string">"contractor|service_account|external"</span>), <span class="hljs-string">"high"</span>, match(category, <span class="hljs-string">"employee|training|user_account|users|administration"</span>), <span class="hljs-string">"medium"</span>, <span class="hljs-number">1</span>==<span class="hljs-number">1</span>, <span class="hljs-string">"unknown"</span>), startDate=strftime(strptime(whenCreated,<span class="hljs-string">"%Y%m%d%H%M"</span>), <span class="hljs-string">"%m/%d/%Y %H:%M"</span>), <span class="hljs-string">"%m/%d/%Y %H:%M"</span>), endDate=strftime(strptime(accountExpires,<span class="hljs-string">"%Y-%m-%dT%H:%M:%S%Z"</span>), <span class="hljs-string">"%m/%d/%Y %H:%M"</span>), watchlist=<span class="hljs-keyword">if</span>(category IN (<span class="hljs-string">"disabled"</span>, <span class="hljs-string">"hold"</span>), <span class="hljs-string">"true"</span>, <span class="hljs-string">"false"</span>), work_city=mvjoin(mvappend(l, st), <span class="hljs-string">", "</span>) 
| <span class="hljs-keyword">rename</span> sAMAccountName as identity, personalTitle as prefix, displayName as nick, givenName as first, sn as <span class="hljs-keyword">last</span>, mail as email, telephoneNumber as phone, mobile as phone2, manager as managedBy, department as bunit, co AS work_country 
| table identity, prefix, nick, first, <span class="hljs-keyword">last</span>, suffix, email, phone, phone2, managedBy, priority, bunit, category, watchlist, startDate, endDate, work_city, work_country, work_lat, work_long 
| outputlookup identities.csv
</code></pre><h4 id="additional-resources">Additional Resources:</h4>
<p><a target="_blank" href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Collect">Splunk Docs on collect</a></p>
<p><a target="_blank" href="https://splunkbase.splunk.com/app/1151/">Download Splunk Supporting Add-on for Active Directory</a></p>
<p><a target="_blank" href="https://docs.splunk.com/Documentation/SA-LdapSearch/3.0.2/User/AbouttheSplunkSupportingAdd-onforActiveDirectory">Splunk Supporting Add-on for Active Directory Documentation</a></p>
<p><a target="_blank" href="https://docs.splunk.com/Documentation/Splunk/8.2.1/Forwarding/Deployaheavyforwarder">Deploy a heavy forwarder</a></p>
<p><a target="_blank" href="https://social.technet.microsoft.com/wiki/contents/articles/5392.active-directory-ldap-syntax-filters.aspx">LDAP Syntax Filters</a></p>
<p> <a target="_blank" href="https://docs.microsoft.com/en-us/windows/win32/ad/user-object-user-interface-mapping">Active Directory Attributes</a> </p>
]]></content:encoded></item></channel></rss>