<?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: Subset Search using in original search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398914#M115662</link>
    <description>&lt;P&gt;I am glad it worked. Before we dig in further, can you accept the answer so that it will be helpful to others.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2019 23:56:51 GMT</pubDate>
    <dc:creator>jawaharas</dc:creator>
    <dc:date>2019-07-23T23:56:51Z</dc:date>
    <item>
      <title>Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398908#M115656</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;Problem Statement : i would want to search the url events in index=proxy having category as "Malicious Sources/Malnets" for last 30 days. Also using the same url from the above result, i would want to search in index=proxy having category="none"&lt;/P&gt;

&lt;P&gt;This is the query i thought of :&lt;BR /&gt;
index=proxy category="none"&lt;BR /&gt;
[| search index="proxy" &lt;BR /&gt;
category="Malicious Sources/Malnets"&lt;BR /&gt;
| stats values(cs_host) as dest] | stats count by dest&lt;/P&gt;

&lt;P&gt;but it doesnt execute.  Could you please help?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 08:36:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398908#M115656</guid>
      <dc:creator>staparia</dc:creator>
      <dc:date>2019-07-17T08:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398909#M115657</link>
      <description>&lt;P&gt;@staparia ,&lt;/P&gt;

&lt;P&gt;If you are looking for URLs which are part of both categories, try this:&lt;BR /&gt;
Assuming &lt;CODE&gt;dest&lt;/CODE&gt; is the field name for urls&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=proxy (category="Malicious Sources/Malnets" OR category="none")
|stats dc(category) as count by dest |where count &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jul 2019 10:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398909#M115657</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-07-17T10:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398910#M115658</link>
      <description>&lt;P&gt;thanks for responding. This didnt yield the result as expected. &lt;/P&gt;

&lt;P&gt;I would want same URL/dest having categories="Malicious Sources/Malnets" and "none". Please note "Malicious Sources/Malnets" category will be a different log and "none" category will be a different event/log  &lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 04:55:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398910#M115658</guid>
      <dc:creator>staparia</dc:creator>
      <dc:date>2019-07-18T04:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398911#M115659</link>
      <description>&lt;P&gt;@richgalloway   ,&lt;BR /&gt;
@renjith.nair &lt;/P&gt;

&lt;P&gt;thanks for responding. This didnt yield the result as expected.&lt;/P&gt;

&lt;P&gt;I would want same URL/dest having categories="Malicious Sources/Malnets" and "none". Please note events with "Malicious Sources/Malnets" category will be a different log and events with "none" category will be a different event/log &lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 12:20:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398911#M115659</guid>
      <dc:creator>staparia</dc:creator>
      <dc:date>2019-07-19T12:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398912#M115660</link>
      <description>&lt;P&gt;Try this. I assume 'cs_host' field exists in all the events of 'proxy' index.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=proxy category="none" 
 [| search index="proxy" 
     category="Malicious Sources/Malnets" 
 | table cs_host] 
| stats count by cs_host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jul 2019 06:24:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398912#M115660</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2019-07-22T06:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398913#M115661</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/212588"&gt;@jawaharas&lt;/a&gt;  Hey .. thanks this works. Hoever to further optimize this using tstats and datamodel..&lt;/P&gt;

&lt;P&gt;I wrote the following query .. and it didnt work :&lt;/P&gt;

&lt;P&gt;| tstats max(_time) AS _time summariesonly=t allow_old_summaries=t count from datamodel=Web.Web WHERE web.category="none" &lt;BR /&gt;
| &lt;CODE&gt;drop_dm_object_name("Web")&lt;/CODE&gt;&lt;BR /&gt;
|  search [| tstats max(_time) AS _time summariesonly=t allow_old_summaries=t count from datamodel=Web.Web WHERE web.category="Malicious Sources/Malnets" GROUPBY  Web.dest&lt;BR /&gt;
| &lt;CODE&gt;drop_dm_object_name("Web")&lt;/CODE&gt; ]&lt;BR /&gt;
| table dest&lt;/P&gt;

&lt;P&gt;Could you please let me know .. where am i wrong in this one...&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:26:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398913#M115661</guid>
      <dc:creator>staparia</dc:creator>
      <dc:date>2020-09-30T01:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398914#M115662</link>
      <description>&lt;P&gt;I am glad it worked. Before we dig in further, can you accept the answer so that it will be helpful to others.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 23:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398914#M115662</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2019-07-23T23:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398915#M115663</link>
      <description>&lt;P&gt;Done. Now request you  to please help on tstats and datamodel query&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 03:27:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398915#M115663</guid>
      <dc:creator>staparia</dc:creator>
      <dc:date>2019-07-24T03:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Subset Search using in original search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398916#M115664</link>
      <description>&lt;P&gt;To debug your SPL with subquery.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Run your subquery using 'format' command&lt;BR /&gt;
| tstats max(_time) AS _time summariesonly=t allow_old_summaries=t count from datamodel=Web.Web WHERE web.category="Malicious Sources/Malnets" GROUPBY Web.dest&lt;BR /&gt;
| drop_dm_object_name("Web")| format&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;This will help you to find the output format of subquery. Substitute the same in your actual SPL&lt;/P&gt;

&lt;P&gt;tstats max(_time) AS _time summariesonly=t allow_old_summaries=t count from datamodel=Web.Web WHERE web.category="none" &lt;BR /&gt;
| drop_dm_object_name("Web")&lt;BR /&gt;
| search [ {OUTPUT OF SUBQUERY}]&lt;BR /&gt;
| table dest&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Ideally this will error out, as the 'table' keyword is missing.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;If you add 'table' keyword to subquery, it will work.&lt;/P&gt;

&lt;P&gt;| tstats max(_time) AS _time summariesonly=t allow_old_summaries=t count from datamodel=Web.Web WHERE web.category="none" &lt;BR /&gt;
| drop_dm_object_name("Web")&lt;BR /&gt;
| search [| tstats max(_time) AS _time summariesonly=t allow_old_summaries=t count from datamodel=Web.Web WHERE web.category="Malicious Sources/Malnets" GROUPBY Web.dest &lt;BR /&gt;
| drop_dm_object_name("Web") | table Web.dest]&lt;BR /&gt;
| table dest&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:26:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subset-Search-using-in-original-search/m-p/398916#M115664</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2020-09-30T01:26:40Z</dc:date>
    </item>
  </channel>
</rss>

