<?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 Get Source Count value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247463#M189123</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The following query below returns the output as shown below :&lt;/P&gt;

&lt;P&gt;Query:&lt;/P&gt;

&lt;P&gt;index="79390-np" sourcetype=np-cache-v2 source="*bp_detail*"  |fields deviceId,bpRuleId  |  join deviceId [search index="79390-np" sourcetype=np-cache-v2 source="*bp_detail*"] |  join bpRuleId [search index="79390-np" sourcetype=np-cache-v2 source="*bp_summary*" bpPrimaryTechnology="*"]  | eval Month=strftime(_time,"%b %Y") | stats count as "totalExceptions",dc(source) as "sourcecount", dc(deviceId) as "uniquedevices" by Month&lt;/P&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;P&gt;Month   totalExceptions sourcecount uniquedevices&lt;BR /&gt;
Feb 2016            181698              1                   4197&lt;BR /&gt;
Mar  2016           550648              1                   4242&lt;/P&gt;

&lt;P&gt;Source data for Feb: bp_detail1.gz&lt;BR /&gt;
Source data or March : bp_detail2.gz, bp_detail3.gz and  bp_detail4.gz&lt;/P&gt;

&lt;P&gt;In the query above "dc(source) as sourcecount"  returns the source count as "1" . I am expecting to some how get the  original source count as "3" for March&lt;BR /&gt;
since there are three source files meeting the criteria(source="*bp_detail*" ) for month of March. I need this count  to find an average month wise.Please let me know.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 09:05:53 GMT</pubDate>
    <dc:creator>amoldesai</dc:creator>
    <dc:date>2020-09-29T09:05:53Z</dc:date>
    <item>
      <title>Get Source Count value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247463#M189123</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The following query below returns the output as shown below :&lt;/P&gt;

&lt;P&gt;Query:&lt;/P&gt;

&lt;P&gt;index="79390-np" sourcetype=np-cache-v2 source="*bp_detail*"  |fields deviceId,bpRuleId  |  join deviceId [search index="79390-np" sourcetype=np-cache-v2 source="*bp_detail*"] |  join bpRuleId [search index="79390-np" sourcetype=np-cache-v2 source="*bp_summary*" bpPrimaryTechnology="*"]  | eval Month=strftime(_time,"%b %Y") | stats count as "totalExceptions",dc(source) as "sourcecount", dc(deviceId) as "uniquedevices" by Month&lt;/P&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;P&gt;Month   totalExceptions sourcecount uniquedevices&lt;BR /&gt;
Feb 2016            181698              1                   4197&lt;BR /&gt;
Mar  2016           550648              1                   4242&lt;/P&gt;

&lt;P&gt;Source data for Feb: bp_detail1.gz&lt;BR /&gt;
Source data or March : bp_detail2.gz, bp_detail3.gz and  bp_detail4.gz&lt;/P&gt;

&lt;P&gt;In the query above "dc(source) as sourcecount"  returns the source count as "1" . I am expecting to some how get the  original source count as "3" for March&lt;BR /&gt;
since there are three source files meeting the criteria(source="*bp_detail*" ) for month of March. I need this count  to find an average month wise.Please let me know.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247463#M189123</guid>
      <dc:creator>amoldesai</dc:creator>
      <dc:date>2020-09-29T09:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get Source Count value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247464#M189124</link>
      <description>&lt;P&gt;Remove the final &lt;CODE&gt;|stats&lt;/CODE&gt; and look at the data you're feeding into it. I'm guessing there's only one &lt;CODE&gt;source&lt;/CODE&gt; value for March, probably because of all those &lt;CODE&gt;join&lt;/CODE&gt;s. Seeing through what those do for your data is impossible from over here.&lt;/P&gt;

&lt;P&gt;For a few alternatives check out &lt;A href="https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2016 17:40:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247464#M189124</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2016-03-14T17:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Get Source Count value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247465#M189125</link>
      <description>&lt;P&gt;I do know that after  all the joins there is one source value for March. But how do I get the original source count . Is there a way to save the source count in a variable before those joins so that I can refer it later  for average calculation.Please let me know. &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 16:47:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247465#M189125</guid>
      <dc:creator>amoldesai</dc:creator>
      <dc:date>2016-03-15T16:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get Source Count value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247466#M189126</link>
      <description>&lt;P&gt;I don't see a point in trying to fix a bunch of joins without knowing the data and requirements for the result - it'll just end in tears.&lt;/P&gt;

&lt;P&gt;For example, what original source count are you looking for? You have three searches, so there are three original source counts to choose from?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 17:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247466#M189126</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2016-03-15T17:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get Source Count value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247467#M189127</link>
      <description>&lt;P&gt;Thanks for looking into it. I am looking to get the source count for &lt;EM&gt;bp_detail&lt;/EM&gt;. It has three source files for March and one for Feb. I have mentioned more about it in my first mail.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 10:07:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-Source-Count-value/m-p/247467#M189127</guid>
      <dc:creator>amoldesai</dc:creator>
      <dc:date>2016-03-16T10:07:46Z</dc:date>
    </item>
  </channel>
</rss>

