<?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: How to get stats by month? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610407#M212268</link>
    <description>&lt;P&gt;My search&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=action AND "True" | dedup _time| stats count as total1| appendcols [search index=action AND "[Home]" | dedup _time| stats count as total2] | appendcols [search index=action AND "False" | dedup _time| stats count as False]| eval True=(total1-total2)|eval False=round(False/(False+True)*100,2)| table False&lt;/P&gt;</description>
    <pubDate>Mon, 22 Aug 2022 23:45:58 GMT</pubDate>
    <dc:creator>SS1</dc:creator>
    <dc:date>2022-08-22T23:45:58Z</dc:date>
    <item>
      <title>How to get stats by month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610386#M212257</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have my current search giving below output, I want to have stats listed by Month. Can someone help on this one&lt;/P&gt;&lt;P&gt;Current Search:&amp;nbsp; &lt;STRONG&gt;my search |&amp;nbsp;&amp;nbsp;eval True=(total1-total2) | eval False=round(False/(True+False)*100,2) | table False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Output:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;42.12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Desired Output:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Month&amp;nbsp; &amp;nbsp; &amp;nbsp; False&lt;/P&gt;&lt;P&gt;August&amp;nbsp; &amp;nbsp; 42.12&lt;/P&gt;&lt;P&gt;July&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xx.xx&lt;/P&gt;&lt;P&gt;june&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xx.xx&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 22:59:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610386#M212257</guid>
      <dc:creator>SS1</dc:creator>
      <dc:date>2022-08-22T22:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get stats by month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610398#M212260</link>
      <description>&lt;LI-CODE lang="markup"&gt;| bin _time span=1mon&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Aug 2022 22:35:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610398#M212260</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-08-22T22:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get stats by month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610401#M212263</link>
      <description>&lt;P&gt;It still doesn't give monthly stats, still shows just the value&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 23:01:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610401#M212263</guid>
      <dc:creator>SS1</dc:creator>
      <dc:date>2022-08-22T23:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get stats by month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610406#M212267</link>
      <description>&lt;P&gt;with bin command, you would normally then use "stats xxxx by _time" to then group values according to the month and then you do your true/false calculations on that.&lt;/P&gt;&lt;P&gt;What is in 'my search' part of your search?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 23:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610406#M212267</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-08-22T23:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to get stats by month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610407#M212268</link>
      <description>&lt;P&gt;My search&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=action AND "True" | dedup _time| stats count as total1| appendcols [search index=action AND "[Home]" | dedup _time| stats count as total2] | appendcols [search index=action AND "False" | dedup _time| stats count as False]| eval True=(total1-total2)|eval False=round(False/(False+True)*100,2)| table False&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 23:45:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610407#M212268</guid>
      <dc:creator>SS1</dc:creator>
      <dc:date>2022-08-22T23:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get stats by month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610429#M212280</link>
      <description>&lt;P&gt;OK, without knowing your data, I would suggest that using appendcols is not the best way to approach the problem.&amp;nbsp; I am not sure why you are deduping _time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have events in index=action that can have&lt;/P&gt;&lt;P&gt;a) any ONE of the 3 possible (True, [Home], False)&lt;BR /&gt;b) one or more of&amp;nbsp;(True, [Home], False)&lt;/P&gt;&lt;P&gt;and as you are deduping _time, it may be that you have more than one with the identical _time value&lt;/P&gt;&lt;P&gt;Depending on the answers to the above, this may be an option&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=action AND ("True" OR "[Home]" OR  "False")
| eval T=if(match(_raw, "(?i)True"), 1, 0)
| eval H=if(match(_raw, "(?i)\[Home\]"), 1, 0)
| eval F=if(match(_raw, "(?i)False"), 1, 0)
| bin _time span=1mon
| stats sum(T) as T sum(H) as H sum(F) as F count by _time
| eval True=(T-H) 
| eval False=round(F/(F+True)*100,2) 
| table False&lt;/LI-CODE&gt;&lt;P&gt;A single search to collect all data. Some eval statements to determine the type of data you are looking at and then the bin of time for 1 month the stats by _time (i.e. 1 month)&lt;/P&gt;&lt;P&gt;Then the calculates for the True/Home/False values.&lt;/P&gt;&lt;P&gt;However, your reason for deduping _time is significant. If there is more than one T, H or F at _time and you want to disregard those, this is not right as it will count those twice.&lt;/P&gt;&lt;P&gt;You could add a&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats max(T) as T max(H) as H max(F) as F by _time&lt;/LI-CODE&gt;&lt;P&gt;before the | bin command to get either a 1 or 0 for time for each value of _time before you aggregate to 1 month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 04:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-stats-by-month/m-p/610429#M212280</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-08-23T04:43:52Z</dc:date>
    </item>
  </channel>
</rss>

