<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: An Alternative to Subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673818#M230692</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/263880"&gt;@dcfrench3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you can put both the searches in the main search and then use stats By the search keys to correlate events, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="iis_logs" sourcetype="iis" s_port="443" sc_status=401 cs_method!="HEAD") OR (index="windows_logs" LogName="Security" Account_Domain=EXCH OR Account_Domain="-" EventCode="4625" OR EventCode="4740" user="john@doe.com" OR user="johndoe")
| eval c_ip=coalesce(Source_Network_Address,c_ip)
| stats dc(index) AS index_count values(*) AS * BY c_ip
| where index_count=2&lt;/LI-CODE&gt;&lt;P&gt;I don't know which fields you need, so I used values(*) AS * but you can use the fields you need.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2024 16:39:15 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2024-01-10T16:39:15Z</dc:date>
    <item>
      <title>An Alternative to Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673801#M230689</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to use a subsearch in order to create a dashboard, but being the subsearches have limitations it is timing out and not producing results. I know the code works when I shorten the duration of time and logs it's ingesting, but that is not an acceptable solution for this dashboard. Is there a better way to write this code or another way for me to produce the results?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="iis_logs" sourcetype="iis" s_port="443" sc_status=401 cs_method!="HEAD" [search index="windows_logs" LogName="Security" Account_Domain=EXCH OR Account_Domain="-" EventCode="4625" OR EventCode="4740" user="john@doe.com" OR user="johndoe" | where NOT cidrmatch("192.168.0.0/16",Source_Network_Address) | top limit=1 Source_Network_Address | dedup Source_Network_Address | rename Source_Network_Address as c_ip | table c_ip]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to take information from first panel in my dashboard and then use that information to do a different search in another panel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 16:17:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673801#M230689</guid>
      <dc:creator>dcfrench3</dc:creator>
      <dc:date>2024-01-10T16:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: An Alternative to Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673818#M230692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/263880"&gt;@dcfrench3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you can put both the searches in the main search and then use stats By the search keys to correlate events, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="iis_logs" sourcetype="iis" s_port="443" sc_status=401 cs_method!="HEAD") OR (index="windows_logs" LogName="Security" Account_Domain=EXCH OR Account_Domain="-" EventCode="4625" OR EventCode="4740" user="john@doe.com" OR user="johndoe")
| eval c_ip=coalesce(Source_Network_Address,c_ip)
| stats dc(index) AS index_count values(*) AS * BY c_ip
| where index_count=2&lt;/LI-CODE&gt;&lt;P&gt;I don't know which fields you need, so I used values(*) AS * but you can use the fields you need.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 16:39:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673818#M230692</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-01-10T16:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: An Alternative to Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673854#M230693</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;here.&lt;BR /&gt;I did notice the use of the&amp;nbsp;&lt;EM&gt;| top limit=1 Source_Network_Address&amp;nbsp;&lt;/EM&gt;in the original subsearch which I think implies that you are trying to scope the search down to a single IP address that shows up the most often in the windows_logs index and not in the 192.168.0.0/16 range.&lt;BR /&gt;&lt;BR /&gt;Which I think can be done with a couple of additional lines like this.&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="iis_logs" sourcetype="iis" s_port="443" sc_status=401 cs_method!="HEAD") OR (index="windows_logs" LogName="Security" Account_Domain=EXCH OR Account_Domain="-" EventCode="4625" OR EventCode="4740" user="john@doe.com" OR user="johndoe")
    | eval 
        c_ip=coalesce(Source_Network_Address,c_ip)
    | stats 
        dc(index) AS index_count,
        count(eval('index'=="windows_logs")) as win_log_count,
        values(*) AS * 
            BY c_ip
    | where index_count=2 AND NOT cidrmatch("192.168.0.0/16", c_ip)
    | sort 1 -win_log_count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 19:33:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673854#M230693</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-10T19:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: An Alternative to Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673871#M230696</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;and &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/263242"&gt;@dtburrows3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for getting back to me. Sorry if my question wasn't 100% clear. So my current goal is that I'm attempting to create a dashboard. In one panel I have a base search of:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="windows_logs" LogName="Security" Account_Domain=EXCH OR Account_Domain="-" EventCode="4625" OR EventCode="4740" user="john@doe.com" OR user="johndoe"&lt;/LI-CODE&gt;&lt;P&gt;This is to grab the reason an account was locked out and would also show the source IP of that information. I essentially need to grab the IP information from this initial search so I can use it in the follow search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="iis_logs" sourcetype="iis" s_port="443" sc_status=401 cs_method!="HEAD" c_ip=&amp;lt;source IP information from initial search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I tried to use a subsearch, but being the I am pulling from an index with iis logs, it's too large of a search and times out before it can complete.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 21:28:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673871#M230696</guid>
      <dc:creator>dcfrench3</dc:creator>
      <dc:date>2024-01-10T21:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: An Alternative to Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673874#M230698</link>
      <description>&lt;P&gt;Ahh I see,&lt;BR /&gt;&lt;BR /&gt;Note: this response is assuming usage of classic Splunk dashboards (XML)&lt;BR /&gt;&lt;BR /&gt;So for panel_1 (used to gather the top source IP)&lt;BR /&gt;You can add a &amp;lt;done&amp;gt; tag and set a token based on the value of Source_Network_Address.&lt;BR /&gt;Example of Search_1:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="windows_logs" LogName="Security" Account_Domain=EXCH OR Account_Domain="-" EventCode="4625" OR EventCode="4740" user="john@doe.com" OR user="johndoe"
    | where NOT cidrmatch("192.168.0.0/16", Source_Network_Address)
    | stats
        count as count,
        values(Account_Domain) as Account_Domain,
        values(EventCode) as EventCode,
        values(user) as user
            by Source_Network_Address
    | sort 1 -count&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This token can then be referenced in panel_2&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="iis_logs" sourcetype="iis" s_port="443" sc_status=401 cs_method!="HEAD" c_ip=$ip$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In the XML this would look something like this,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.
.
.
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;
            index="windows_logs" LogName="Security" Account_Domain=EXCH OR Account_Domain="-" EventCode="4625" OR EventCode="4740" user="john@doe.com" OR user="johndoe"
    | where NOT cidrmatch("192.168.0.0/16", Source_Network_Address)
    | stats
        count as count,
        values(Account_Domain) as Account_Domain,
        values(EventCode) as EventCode,
        values(user) as user
            by Source_Network_Address
    | sort 1 -count
          &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;set token="ip"&amp;gt;$result.Source_Network_Address$&amp;lt;/set&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
.
.
.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Notice the &amp;lt;done&amp;gt;&amp;lt;set token="ip"&amp;gt;$result.Source_Network_Address$&amp;lt;/set&amp;gt;&amp;lt;/done&amp;gt; nested in the &amp;lt;search&amp;gt; tags. This is taking the final result's value from the field Source_Network_Address and assigning it to a token named $ip$. This token can then be referenced by panel_2.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 21:43:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/673874#M230698</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-10T21:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: An Alternative to Subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/674610#M230914</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/263880"&gt;@dcfrench3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 06:59:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/An-Alternative-to-Subsearch/m-p/674610#M230914</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-01-18T06:59:57Z</dc:date>
    </item>
  </channel>
</rss>

