<?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 Need count for fields value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409385#M171824</link>
    <description>&lt;P&gt;Hi Friends,&lt;/P&gt;

&lt;P&gt;I have two field component and eventtype, need count of  component=root and  component=Metrics and venttype=splunkd-log and eventtype=splunkd-access .&lt;/P&gt;

&lt;P&gt;Am using below command but getting count of components only not eventtype, morover my data is big can we used tstats command in such case.Thanks&lt;/P&gt;

&lt;P&gt;index="_internal" component=root OR component=Metrics OR eventtype=splunkd-log OR eventtype=splunkd-access | stats count by component&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2019 05:10:54 GMT</pubDate>
    <dc:creator>rakesh44</dc:creator>
    <dc:date>2019-04-17T05:10:54Z</dc:date>
    <item>
      <title>Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409385#M171824</link>
      <description>&lt;P&gt;Hi Friends,&lt;/P&gt;

&lt;P&gt;I have two field component and eventtype, need count of  component=root and  component=Metrics and venttype=splunkd-log and eventtype=splunkd-access .&lt;/P&gt;

&lt;P&gt;Am using below command but getting count of components only not eventtype, morover my data is big can we used tstats command in such case.Thanks&lt;/P&gt;

&lt;P&gt;index="_internal" component=root OR component=Metrics OR eventtype=splunkd-log OR eventtype=splunkd-access | stats count by component&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 05:10:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409385#M171824</guid>
      <dc:creator>rakesh44</dc:creator>
      <dc:date>2019-04-17T05:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409386#M171825</link>
      <description>&lt;P&gt;@rakesh44 &lt;BR /&gt;
You can use &lt;CODE&gt;eval()&lt;/CODE&gt; to get the count of specific value.&lt;BR /&gt;
Check below search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_internal" component=root OR component=Metrics OR eventtype=splunkd-log OR eventtype=splunkd-access | stats count(eval(component="Metrics")) as Metrics_count, count(eval(component="root")) as Root_count, count(eval(eventtype="splunkd-log")) as Splunkd_log_count, count(eval(eventtype="splunkd-access")) as Splunkd_access_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Apr 2019 05:29:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409386#M171825</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-17T05:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409387#M171826</link>
      <description>&lt;P&gt;Thanks Kamlesh for quick reply&lt;/P&gt;

&lt;P&gt;Its works for me,  can we expedite search its very slow , I have many events.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 05:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409387#M171826</guid>
      <dc:creator>rakesh44</dc:creator>
      <dc:date>2019-04-17T05:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409388#M171827</link>
      <description>&lt;P&gt;@rakesh44&lt;/P&gt;

&lt;P&gt;Can you please try this search for performace?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(eval(component="Metrics")) as Metrics_count, count(eval(component="root")) as Root_count, count(eval(eventtype="splunkd-log")) as Splunkd_log_count, count(eval(eventtype="splunkd-access")) as Splunkd_access_count count from datamodel=internal_server WHERE component=root OR component=Metrics OR eventtype=splunkd-log OR eventtype=splunkd-access
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Apr 2019 06:52:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409388#M171827</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-17T06:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409389#M171828</link>
      <description>&lt;P&gt;Thanks Kamlesh for quick reply&lt;/P&gt;

&lt;P&gt;Tried with given command , but ending with error&lt;/P&gt;

&lt;P&gt;Error in 'TsidxStats': The tstats / mstats command cannot apply eval function to aggregation function. &lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 08:12:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409389#M171828</guid>
      <dc:creator>rakesh44</dc:creator>
      <dc:date>2019-04-17T08:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409390#M171829</link>
      <description>&lt;P&gt;@rakesh44 &lt;/P&gt;

&lt;P&gt;It's working for me in Splunk 7.2.3. Check below link.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://drive.google.com/open?id=1DCEOpNokZBA6OLW6m7MxgJYVZFPcmvzz"&gt;https://drive.google.com/open?id=1DCEOpNokZBA6OLW6m7MxgJYVZFPcmvzz&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Can you please share your search if you have changed and Splunk version information?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 09:01:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409390#M171829</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-17T09:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409391#M171830</link>
      <description>&lt;P&gt;appreciate for your help&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 11:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409391#M171830</guid>
      <dc:creator>rakesh44</dc:creator>
      <dc:date>2019-04-17T11:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409392#M171831</link>
      <description>&lt;P&gt;index="_internal" component=root OR component=Metrics OR eventtype=splunkd-log OR eventtype=splunkd-access | stats count(eval(component="Metrics")) as Metrics_count, count(eval(component="root")) as Root_count, count(eval(eventtype="splunkd-log")) as Splunkd_log_count, count(eval(eventtype="splunkd-access")) as Splunkd_access_count&lt;/P&gt;

&lt;P&gt;If you want to improve performance use below command ( Both command are working fine )&lt;/P&gt;

&lt;P&gt;| tstats count(eval(component="Metrics")) as Metrics_count, count(eval(component="root")) as Root_count, count(eval(eventtype="splunkd-log")) as Splunkd_log_count, count(eval(eventtype="splunkd-access")) as Splunkd_access_count count from datamodel=internal_server WHERE component=root OR component=Metrics OR eventtype=splunkd-log OR eventtype=splunkd-access&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:06:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409392#M171831</guid>
      <dc:creator>rakesh44</dc:creator>
      <dc:date>2020-09-30T00:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409393#M171832</link>
      <description>&lt;P&gt;I dont see option to accept your answer and hence posting your answer again&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 11:19:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409393#M171832</guid>
      <dc:creator>rakesh44</dc:creator>
      <dc:date>2019-04-17T11:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need count for fields value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409394#M171833</link>
      <description>&lt;P&gt;@rakesh44&lt;/P&gt;

&lt;P&gt;Now you can mark it Accept.  &lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 12:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-count-for-fields-value/m-p/409394#M171833</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-17T12:07:27Z</dc:date>
    </item>
  </channel>
</rss>

