<?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: Count number of occurrences in more than one field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42564#M9951</link>
    <description>&lt;P&gt;Hi @gkanapthy, and @tnkoehn&lt;/P&gt;

&lt;P&gt;I have similar requirement but instead of  | where match(Inbound, "^(ATT|MCI|QST)") OR match(Outbound, "^(ATT|MCI|QST)") &lt;BR /&gt;
i have &lt;BR /&gt;
 | where match(Inbound, "abc") OR match(Outbound, "def") &lt;BR /&gt;
now how should i achieve this&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2017 16:04:27 GMT</pubDate>
    <dc:creator>surekhasplunk</dc:creator>
    <dc:date>2017-11-22T16:04:27Z</dc:date>
    <item>
      <title>Count number of occurrences in more than one field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42561#M9948</link>
      <description>&lt;P&gt;I have two fields, Inbound and Outbound. Each of these fields can contain a group (sometimes they're null). I need to get a count of the groups if they match a specific regex (i.e. must start with ATT, MCI or QST). The problem is that a valid group can be in either field, and certain groups can be both an Inbound and Outbound group. Below is a small example of some events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Inbound   Outbound
OMA01002  QST_0960
ATT_0002  QST_0965
OMA01000  QST_0960
ATT_0004
ATT_0119  ATT_0002 
MCI_0023 
QST_0960  ATT_0407
          ATT_0119
ATT_0004  RG17
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see in the example ATT_0002, ATT_0119 and QST_0960 can be an Inbound or Outbound group. But I don't care about what group it is, I only care about the counts for each group. So the results I need are:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Group      Count
ATT_0002   2
ATT_0004   2
ATT_0119   2
ATT_0407   1
MCI_0023   1
QST_0960   3
QST_0965   1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure how to do this or if it's possible without two searches. Below is a simplified search that is kind of a starting point.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search * | fields Inbound Outbound
         | where match(Inbound, "^(ATT|MCI|QST)") OR match(Outbound, "^(ATT|MCI|QST)") 
         | do amazing counting stuff here
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this makes sense. Thanks for any help.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42561#M9948</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2020-09-28T13:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of occurrences in more than one field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42562#M9949</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;... | eval Group=mvappend(Inbound,Outbound) | stats count by Group
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Feb 2013 19:07:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42562#M9949</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2013-02-25T19:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of occurrences in more than one field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42563#M9950</link>
      <description>&lt;P&gt;So simple. You guys make me feel like an idiot, but it's precisely what I need. Thanks so much!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2013 19:28:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42563#M9950</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2013-02-26T19:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of occurrences in more than one field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42564#M9951</link>
      <description>&lt;P&gt;Hi @gkanapthy, and @tnkoehn&lt;/P&gt;

&lt;P&gt;I have similar requirement but instead of  | where match(Inbound, "^(ATT|MCI|QST)") OR match(Outbound, "^(ATT|MCI|QST)") &lt;BR /&gt;
i have &lt;BR /&gt;
 | where match(Inbound, "abc") OR match(Outbound, "def") &lt;BR /&gt;
now how should i achieve this&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 16:04:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-occurrences-in-more-than-one-field/m-p/42564#M9951</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2017-11-22T16:04:27Z</dc:date>
    </item>
  </channel>
</rss>

