<?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 events by day when stats has multiple BY clause in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532366#M150388</link>
    <description>&lt;P&gt;To get per-day stats, use &lt;FONT face="courier new,courier"&gt;bin span=1d _time&lt;/FONT&gt;.&amp;nbsp; Other fields won't get you per-day info.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2020 17:59:33 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-12-08T17:59:33Z</dc:date>
    <item>
      <title>count events by day when stats has multiple BY clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532277#M150365</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Goal -&amp;nbsp;&lt;/STRONG&gt;I am searching for&amp;nbsp; "number of actions per unique customer" metrics from API metric logs.&lt;BR /&gt;&lt;BR /&gt;below is my query. Below query is filtering results by providing specific &lt;EM&gt;request.path&amp;nbsp;&lt;/EM&gt;and then getting stats by&amp;nbsp;&lt;EM&gt;Customer_Id and _time.&amp;nbsp;&amp;nbsp;&lt;/EM&gt;and then getting the total count as uniqueCustomers and sum up those counts so that it will get the totalActions and the &lt;EM&gt;res&amp;nbsp;&lt;/EM&gt;is actually diving totalActions/uniqueCustomers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="some_index" sourcetype="api-index" message="Metrics Information" | rex field=request.path "/v1/actions-api/(?&amp;lt;Customer_Id&amp;gt;\w+)" | stats count by Customer_Id, _time | eventstats count as uniqueCustomers | eventstats sum(count) as totalActions  | eval result = totalActions/uniqueCustomers &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;The problem is that I don't know how to count these result per day. I tried below but isn't working because it has two BY clauses. Please suggest some solutions. Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bin _time span=1d&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 14:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532277#M150365</guid>
      <dc:creator>mrmiddleclass1</dc:creator>
      <dc:date>2020-12-08T14:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: count events by day when stats has multiple BY clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532366#M150388</link>
      <description>&lt;P&gt;To get per-day stats, use &lt;FONT face="courier new,courier"&gt;bin span=1d _time&lt;/FONT&gt;.&amp;nbsp; Other fields won't get you per-day info.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 17:59:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532366#M150388</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-12-08T17:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: count events by day when stats has multiple BY clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532396#M150401</link>
      <description>&lt;P&gt;Thanks for the reply. As I mentioned above, I tried&amp;nbsp;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;bin span=1d _time&amp;nbsp;&lt;FONT face="arial,helvetica,sans-serif"&gt;but it isn't working probably because I have multiple BY clause&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;bin span=1d _time&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 21:15:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532396#M150401</guid>
      <dc:creator>mrmiddleclass1</dc:creator>
      <dc:date>2020-12-08T21:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: count events by day when stats has multiple BY clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532409#M150405</link>
      <description>&lt;P&gt;It should work.&amp;nbsp; Please show the full query with the bin command and explain what is not working.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 22:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-events-by-day-when-stats-has-multiple-BY-clause/m-p/532409#M150405</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-12-08T22:37:02Z</dc:date>
    </item>
  </channel>
</rss>

