<?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 How do I use count multiple times in one search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373966#M109936</link>
    <description>&lt;P&gt;How do I use count multiple times in one search?&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search * | stats count by f1, f2 count by f3, f4
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 Jun 2017 21:28:36 GMT</pubDate>
    <dc:creator>tcollins93</dc:creator>
    <dc:date>2017-06-28T21:28:36Z</dc:date>
    <item>
      <title>How do I use count multiple times in one search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373966#M109936</link>
      <description>&lt;P&gt;How do I use count multiple times in one search?&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search * | stats count by f1, f2 count by f3, f4
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jun 2017 21:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373966#M109936</guid>
      <dc:creator>tcollins93</dc:creator>
      <dc:date>2017-06-28T21:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use count multiple times in one search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373967#M109937</link>
      <description>&lt;P&gt;can you elaborate? maybe add some sample data and use case? if you have an idea of how you would like your results to look like it can also be very beneficial...&lt;BR /&gt;
to your question, you can count by as many fields you want ... | stats count by f1 f2 f3 .... fN&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 00:47:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373967#M109937</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-06-29T00:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use count multiple times in one search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373968#M109938</link>
      <description>&lt;P&gt;Your question is not very clear, but perhaps you are looking for &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eventstats"&gt;eventstats&lt;/A&gt;? &lt;BR /&gt;
That would allow you to run multiple stats commands over the data in different ways.&lt;/P&gt;

&lt;P&gt;Or perhaps you want to combine your count with an eval statement? Examples are in previous &lt;A href="https://answers.splunk.com/answers/151179/how-to-use-stats-and-eval-to-count-how-many-times-microsoft-is-included-in-the-os.html"&gt;posts&lt;/A&gt; or the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Search/Usestatswithevalexpressionsandfunctions"&gt;documentation&lt;/A&gt; &lt;BR /&gt;
The above will allow conditional counting&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 02:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373968#M109938</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-06-29T02:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use count multiple times in one search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373969#M109939</link>
      <description>&lt;P&gt;Without much info, I would suggest this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search * | stats count by f1, f2 f3, f4
| appendpipe [| stats sum(count) as count by f1,f2 | eval keep=1]
| appendpipe [| stats sum(count) as count by f3,f4 | eval keep=1]
| where keep=1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 04:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-count-multiple-times-in-one-search/m-p/373969#M109939</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-29T04:22:46Z</dc:date>
    </item>
  </channel>
</rss>

