<?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: Search within the search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684264#M233592</link>
    <description>&lt;P&gt;host is a field sometimes populated by Splunk to identify where logs were ingested from - could this be your issue?&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2024 16:18:21 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-04-15T16:18:21Z</dc:date>
    <item>
      <title>Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684253#M233582</link>
      <description>&lt;P&gt;I need to identify hosts with errors, but only in block mode&lt;BR /&gt;MY SPL&lt;BR /&gt;---------&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=firewall event_type="error [search index=firewall sourcetype="metadata" enforcement_mode=block]
| dedup host
| table event_type, host, ip&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;------------------&lt;BR /&gt;&lt;BR /&gt;each search works separately, but combined it seating on "parsing job"&amp;nbsp; with no result for long time.&lt;BR /&gt;&lt;BR /&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 18:05:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684253#M233582</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-15T18:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684257#M233586</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=firewall event_type="error" [search index=firewall sourcetype="metadata" enforcement_mode=block
| dedup host
| format]
| table event_type, host, ip &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 Apr 2024 14:52:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684257#M233586</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-15T14:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684259#M233588</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp;&lt;BR /&gt;Unfortunately proposed change produced 0 events&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 14:56:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684259#M233588</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-15T14:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684260#M233589</link>
      <description>&lt;P&gt;Sorry, I missed a line, try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=firewall event_type="error" [search index=firewall sourcetype="metadata" enforcement_mode=block
| dedup host
| table host
| format]
| table event_type, host, ip &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 Apr 2024 14:58:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684260#M233589</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-15T14:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684261#M233590</link>
      <description>&lt;P&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Because in different data source I see host name under different fields&amp;nbsp;&lt;BR /&gt;i.e. in metadata "host1" and in collector just "host", I added rename&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=firewall event_type="error" [search index=firewall sourcetype="metadata" enforcement_mode=block
| rename host1 as host
|dedup host
| table host
| format]
| table event_type, host, ip&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;--------&lt;BR /&gt;Now I am back to square 1&amp;nbsp; - it runs but no events produced and never finish.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 15:56:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684261#M233590</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-15T15:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684264#M233592</link>
      <description>&lt;P&gt;host is a field sometimes populated by Splunk to identify where logs were ingested from - could this be your issue?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 16:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684264#M233592</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-15T16:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684265#M233593</link>
      <description>&lt;P&gt;Since it's the same index with two different source types, could be SPL build differentially?&lt;BR /&gt;-------------------&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) enforcement_mode=block event_type="error"
|table event_type, hostname, ip
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 20:00:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684265#M233593</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-15T20:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684273#M233595</link>
      <description>&lt;P&gt;You could do that, if it gives you what you need.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 19:23:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684273#M233595</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-15T19:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684342#M233620</link>
      <description>&lt;P&gt;As both searches invoke the same index, there is probably not much point (unless you have a very very specific use case) to use subsearch here.&lt;/P&gt;&lt;P&gt;Just search for&lt;/P&gt;&lt;PRE&gt;index=firewall event_type=error sourcetype=metadata enforcement_mode=block&lt;/PRE&gt;&lt;P&gt;Because that's effectively what your search would do.&lt;/P&gt;&lt;P&gt;Having said that - that is probably _not_ what you need.&lt;/P&gt;&lt;P&gt;I'd hazard a guess that you're probably looking for something like&lt;/P&gt;&lt;PRE&gt;index=firewall&lt;BR /&gt;| stats values(event_type) as event_types values(sourcetype) as sourcetypes values(enforcement_mode) as enforcement_modes&lt;BR /&gt;| where enforcement_mode="block"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 09:46:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684342#M233620</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-04-16T09:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684352#M233621</link>
      <description>&lt;P&gt;Something in my solution is not right.&lt;BR /&gt;It works for only one condition (one or another) but combined produced zero events&lt;/P&gt;&lt;P&gt;---------&lt;BR /&gt;Events&lt;BR /&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) enforcement_mode=block&lt;BR /&gt;|table event_type, hostname, ip&lt;BR /&gt;-------------&lt;/P&gt;&lt;P&gt;Events&lt;/P&gt;&lt;P&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) event_type="error"&lt;BR /&gt;|table event_type, hostname, ip&lt;/P&gt;&lt;P&gt;------------&lt;BR /&gt;No events&lt;/P&gt;&lt;P&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) enforcement_mode=block event_type="error"&lt;BR /&gt;|table event_type, hostname, ip&lt;BR /&gt;--------------&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 11:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684352#M233621</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-16T11:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684361#M233622</link>
      <description>&lt;P&gt;You haven't told us what you want the search to do so I'm only guessing. Probably your hosts log events which have either enforcement_mode=block field or event_type=error field but no single event has both of these fields set. So your "combined" search will not find them because both conditions aren't fulfilled in a single event.&lt;/P&gt;&lt;P&gt;That's why you need to correlate multple events by using either transaction or stats (the stats approach is preferred due to transaction command's limitations).&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 12:44:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684361#M233622</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-04-16T12:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684362#M233623</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) (enforcement_mode=block OR event_type="error")
|table event_type, hostname, ip&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 16 Apr 2024 12:52:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684362#M233623</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-16T12:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684378#M233632</link>
      <description>&lt;P&gt;Something in my solution is not right.&lt;BR /&gt;It works for only one condition (one or another) but combined produced zero events&lt;/P&gt;
&lt;P&gt;---------&lt;BR /&gt;Events reported&amp;nbsp;&lt;BR /&gt;-----------&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) enforcement_mode=block
|table event_type, hostname, ip&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;-------------&lt;/P&gt;
&lt;P&gt;Events reported&lt;BR /&gt;-----------&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) event_type="error"
|table event_type, hostname, ip&lt;/LI-CODE&gt;
&lt;P&gt;------------&lt;BR /&gt;No events reported&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=firewall (sourcetype=collector OR sourcetype=metadata) enforcement_mode=block event_type="error"
|table event_type, hostname, ip&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 16 Apr 2024 17:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684378#M233632</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-16T17:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684382#M233634</link>
      <description>&lt;P&gt;Have you tried my suggestion?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 15:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/684382#M233634</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-04-16T15:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/685005#M233777</link>
      <description>&lt;P&gt;Thank you very much for your help.&lt;BR /&gt;&lt;BR /&gt;The code that works&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;-------&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=firewall event_type="error" [search index=firewall sourcetype="metadata" enforcement_mode=block
| dedup host1
| table host1
| format]
|  dedup host
| table event_type, host, ip&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;-----------&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 15:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/685005#M233777</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-04-22T15:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Search within the search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/685024#M233780</link>
      <description>&lt;P&gt;Be aware that subsearches have limitations and it can be nasty if you hit the limit because the search will be finalized silently. You won't know something's not right.&lt;/P&gt;&lt;P&gt;Also the&lt;/P&gt;&lt;PRE&gt;| dedup host&lt;BR /&gt;| table host&lt;/PRE&gt;&lt;P&gt;part is quite suboptimal.&lt;/P&gt;&lt;P&gt;And in general be wary when using the dedup command (you have it in outer search as well) - it might behave differently than you'd expect.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 19:44:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-within-the-search/m-p/685024#M233780</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-04-22T19:44:02Z</dc:date>
    </item>
  </channel>
</rss>

