<?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: How to match at least one field from separate events but the same source file? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-at-least-one-field-from-separate-events-but-the/m-p/644678#M223249</link>
    <description>&lt;P&gt;that worked! Not sure how I missed this. Thx!&lt;/P&gt;</description>
    <pubDate>Thu, 25 May 2023 20:19:31 GMT</pubDate>
    <dc:creator>dmoberg</dc:creator>
    <dc:date>2023-05-25T20:19:31Z</dc:date>
    <item>
      <title>How to match at least one field from separate events but the same source file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-at-least-one-field-from-separate-events-but-the/m-p/644650#M223243</link>
      <description>&lt;P&gt;We have a log file that is split into multiple events. In these events we need to count the number of occurrences where Event XXX &amp;gt; 0 and Event YYY &amp;gt; 0 for each Source file. So finding 1 match of XXX and YYY in one particular Source file would be counted as 1 for this purpose.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Splunk search:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SEARCH (patterns matching Events of type A) OR (patterns matching Events of type B) | eval isDEP=if(match(NAME, "(?i).*(XXX).*"), 1, 0) | eval isPERF=if(match(NAME, ".*(YYY).*"), 1, 0) | stats list(NAME),list(isDEP),list(isPERF),count by source&lt;/LI-CODE&gt;&lt;P&gt;In the Search part of the query I find the type of Events of interest, then determine the count of matches for XXX and YYY. This works fine, the problem is that I do not know how to tell Splunk to give me:&lt;/P&gt;&lt;P&gt;If XXX &amp;gt; 0 AND YYY &amp;gt; 0 for a particular Source file (aggregate by Source), then count this as 1.&lt;/P&gt;&lt;P&gt;This is an example output for the above query:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmoberg_0-1685025538091.png" style="width: 748px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25546iF1DEF5670422ACBF/image-dimensions/748x43?v=v2" width="748" height="43" role="button" title="dmoberg_0-1685025538091.png" alt="dmoberg_0-1685025538091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The issue seems to be that Splunk works on an "per Event" basis so each result is tied with the Event and not the Source file.&lt;/P&gt;&lt;P&gt;Any ideas on how to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 18:22:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-at-least-one-field-from-separate-events-but-the/m-p/644650#M223243</guid>
      <dc:creator>dmoberg</dc:creator>
      <dc:date>2023-05-25T18:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to match at least one field from separate events but the same source file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-at-least-one-field-from-separate-events-but-the/m-p/644671#M223247</link>
      <description>&lt;P&gt;See if this helps&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SEARCH (patterns matching Events of type A) OR (patterns matching Events of type B) 
| eval isDEP=if(match(NAME, "(?i).*(XXX).*"), 1, 0) 
| eval isPERF=if(match(NAME, ".*(YYY).*"), 1, 0) 
| stats list(NAME),sum(isDEP) as depCount, sum(isPERF) as perfCount, count by source
| where (depCount&amp;gt;1 AND perfCount&amp;gt;1)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 25 May 2023 18:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-at-least-one-field-from-separate-events-but-the/m-p/644671#M223247</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-05-25T18:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to match at least one field from separate events but the same source file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-match-at-least-one-field-from-separate-events-but-the/m-p/644678#M223249</link>
      <description>&lt;P&gt;that worked! Not sure how I missed this. Thx!&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 20:19:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-match-at-least-one-field-from-separate-events-but-the/m-p/644678#M223249</guid>
      <dc:creator>dmoberg</dc:creator>
      <dc:date>2023-05-25T20:19:31Z</dc:date>
    </item>
  </channel>
</rss>

