<?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 write a search for continuous day count? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372849#M109627</link>
    <description>&lt;P&gt;sorry for the confusion&lt;/P&gt;

&lt;P&gt;Day                                              count&lt;BR /&gt;
 Mon Mar.1.2017                          1&lt;BR /&gt;
 Tue Mar.2.2017                           2 &lt;BR /&gt;
 Thu  Mar.3.2017                          4&lt;BR /&gt;
 Fri    Mar.5.2017                          7&lt;BR /&gt;
 Sat   Mar.6.2017                           8&lt;/P&gt;

&lt;P&gt;now want to include missing day count as 0&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2017 03:17:33 GMT</pubDate>
    <dc:creator>srinivasup</dc:creator>
    <dc:date>2017-05-11T03:17:33Z</dc:date>
    <item>
      <title>How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372846#M109624</link>
      <description>&lt;P&gt;I have a scenario that when i write a search, i will get count for each day. But if there is no count that day, the row is not appearing&lt;/P&gt;

&lt;P&gt;Ex: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Day count
Mon 1
Tue 2
Sat 3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the output, but here Wed, Thu, Friday days are missing. So i would like hard code the days or want to include missing dates with count zero&lt;/P&gt;

&lt;P&gt;Something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Day count
Mon 1
Tue 2
Wed 2
Thu 3
Fri 5
Sat 6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sometimes days may change , please help in writing a search  &lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 19:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372846#M109624</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-10T19:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372847#M109625</link>
      <description>&lt;P&gt;What's your current query and time-range??&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 19:30:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372847#M109625</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-05-10T19:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372848#M109626</link>
      <description>&lt;P&gt;Assuming that values of days are always Mon to Sat, you can try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search 
| append [| gentimes start=-1 | eval Day=split("Mon Tue Wed Thu Fri Sat"," ") | table Day | mvexpand Day | eval count=0 ]
| stats max(count) as count by Day
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 22:14:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372848#M109626</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-05-10T22:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372849#M109627</link>
      <description>&lt;P&gt;sorry for the confusion&lt;/P&gt;

&lt;P&gt;Day                                              count&lt;BR /&gt;
 Mon Mar.1.2017                          1&lt;BR /&gt;
 Tue Mar.2.2017                           2 &lt;BR /&gt;
 Thu  Mar.3.2017                          4&lt;BR /&gt;
 Fri    Mar.5.2017                          7&lt;BR /&gt;
 Sat   Mar.6.2017                           8&lt;/P&gt;

&lt;P&gt;now want to include missing day count as 0&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 03:17:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372849#M109627</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-11T03:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372850#M109628</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search 
 | append [| gentimes start=-1 | addinfo | eval Day=mvrange(info_min_time,info_max_time+86400,86400)  | table Day | mvexpand Day | eval Day=strftime(Day,"%a %b.%d.%Y") | eval count=0 ]
 | stats max(count) as count by Day
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;May need to adjust mvrange command upper limit.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 03:24:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372850#M109628</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-05-11T03:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372851#M109629</link>
      <description>&lt;P&gt;What is the final transforming command you are using to create your statistical table?&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 04:08:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372851#M109629</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-05-11T04:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372852#M109630</link>
      <description>&lt;P&gt;can you use the &lt;CODE&gt;|makecontinuous&lt;/CODE&gt; command on your _time field? followed by &lt;CODE&gt;|fillnull count value=0&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.6.0/SearchReference/Makecontinuous"&gt;https://docs.splunk.com/Documentation/Splunk/6.6.0/SearchReference/Makecontinuous&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 12:04:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372852#M109630</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-05-11T12:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372853#M109631</link>
      <description>&lt;P&gt;my query |inputlookup Day.csv and output is as follows &lt;/P&gt;

&lt;P&gt;Day                      count&lt;/P&gt;

&lt;P&gt;Mon May.2.2017   1&lt;BR /&gt;
Tue May.3.2017   2&lt;BR /&gt;
Sat May.7.2017      3&lt;/P&gt;

&lt;P&gt;i want to see the output&lt;/P&gt;

&lt;P&gt;Mon May.2.2017  1&lt;BR /&gt;
Tue May.3.2017  2&lt;BR /&gt;
wed                         0&lt;BR /&gt;
Thu                          0&lt;BR /&gt;
Fri                             0&lt;BR /&gt;
Sat May.7.2017     3&lt;/P&gt;

&lt;P&gt;tried above query but didnt work&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 18:19:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372853#M109631</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-11T18:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372854#M109632</link>
      <description>&lt;P&gt;my query |inputlookup Day.csv and output is as follows&lt;/P&gt;

&lt;P&gt;Day count&lt;/P&gt;

&lt;P&gt;Mon May.2.2017 1&lt;BR /&gt;
Tue May.3.2017 2&lt;BR /&gt;
Sat May.7.2017 3&lt;/P&gt;

&lt;P&gt;i want to see the output&lt;/P&gt;

&lt;P&gt;Mon May.2.2017 1&lt;BR /&gt;
Tue May.3.2017 2&lt;BR /&gt;
wed 0&lt;BR /&gt;
Thu 0&lt;BR /&gt;
Fri 0&lt;BR /&gt;
Sat May.7.2017 3&lt;/P&gt;

&lt;P&gt;tried above query but didnt work&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 18:23:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372854#M109632</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-11T18:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372855#M109633</link>
      <description>&lt;P&gt;Using @cmerriman's solution, this should do it&lt;BR /&gt;
&lt;STRONG&gt;Updated&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup Day.csv
| eval _time=strptime(Day,"%a %b.%d.%Y")
| makecontinuous | eval Day=strftime(_time,"%a %b.%d.%Y") | fields - _time
| fillnull value=0 count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 May 2017 18:36:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372855#M109633</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-05-11T18:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372856#M109634</link>
      <description>&lt;P&gt;Day                     _time                             count&lt;BR /&gt;
Mon May.2.2017  2017-05-02                      1&lt;BR /&gt;
Tue May.3.2017  2017-05-03                       2&lt;BR /&gt;
                            2017-05-04                       0&lt;BR /&gt;
                            2017-05-05                         0&lt;BR /&gt;
                            2017-05-06                         0&lt;BR /&gt;
Sat May.7.2017  2017-05-07                       3&lt;/P&gt;

&lt;P&gt;This is how it is comming but under Day column it should display weekdays but it is showking blanks, please help&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 18:58:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372856#M109634</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-11T18:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372857#M109635</link>
      <description>&lt;P&gt;And its not displaying sunday&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 20:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372857#M109635</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-11T20:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372858#M109636</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="Mon 1::Tue 2::Sat 3" 
| makemv delim="::" raw 
| mvexpand raw 
| rex field=raw "^(?&amp;lt;Day&amp;gt;\S+)\s+(?&amp;lt;count&amp;gt;\S+)$" 
| fields - _time raw 

| rename COMMENT AS "Everything above fakes sample (intermediate) data; everything below is your solution"
| rename COMMENT AS "YOUR EXISTING SEARCH HERE"

| append 
    [| makeresults count=7 
    | streamstats count AS serial 
    | eval Day=case(serial=1, "Mon", serial=2, "Tue", serial=3, "Wed", serial=4, "Thu", serial=5, "Fri", serial=6, "Sat", serial=7, "Sun", true(), "N/A")
    | fields - _time
    | eval count=0 ]
| stats sum(count) AS count first(serial) AS serial BY Day
| sort 0 serial
| fields - serial
| eval count=if(count=0, null(), count)
| filldown count
| fillnull count value="0"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2017 05:32:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372858#M109636</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-12T05:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372859#M109637</link>
      <description>&lt;P&gt;try this!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-7|eval day=strftime(endtime,"%a") ,count=0|fields day,count
  |join type=outer day [search (your search)|eval day=strftime(_time,"%a")|stats count by day]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2017 10:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372859#M109637</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-05-12T10:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372860#M109638</link>
      <description>&lt;P&gt;this is working but we need to append time for weekdays&lt;/P&gt;</description>
      <pubDate>Sun, 21 May 2017 17:11:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372860#M109638</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-21T17:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372861#M109639</link>
      <description>&lt;P&gt;I do not understand.   What is your output now and what should it be?&lt;/P&gt;</description>
      <pubDate>Sun, 21 May 2017 18:30:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372861#M109639</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-21T18:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372862#M109640</link>
      <description>&lt;P&gt;Input:&lt;/P&gt;

&lt;P&gt;Day                         count&lt;BR /&gt;
Mon May.2.2017  1&lt;BR /&gt;
Tue May.3.2017  2&lt;BR /&gt;
Sat May.7.2017  3&lt;/P&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;P&gt;Day                        count&lt;BR /&gt;
Mon                     1&lt;BR /&gt;
Tue May.3.2017  2&lt;BR /&gt;
Wed ...............&lt;BR /&gt;&lt;BR /&gt;
Thu ...............&lt;BR /&gt;&lt;BR /&gt;
Fri ...............&lt;BR /&gt;&lt;BR /&gt;
Sat May.7.2017  3&lt;BR /&gt;
Sun ...............  &lt;/P&gt;

&lt;P&gt;As per the previous query we could able to add week days but now we want to add days corresponding to each week day&lt;/P&gt;</description>
      <pubDate>Sun, 21 May 2017 18:48:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372862#M109640</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-21T18:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372863#M109641</link>
      <description>&lt;P&gt;Input:&lt;/P&gt;

&lt;P&gt;Day count&lt;BR /&gt;
Mon May.2.2017 1&lt;BR /&gt;
Tue May.3.2017 2&lt;BR /&gt;
Sat May.7.2017 3&lt;/P&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;P&gt;Day count&lt;BR /&gt;
Mon 1&lt;BR /&gt;
Tue May.3.2017 2&lt;BR /&gt;
Wed ............... &lt;BR /&gt;
Thu ............... &lt;BR /&gt;
Fri ............... &lt;BR /&gt;
Sat May.7.2017 3&lt;BR /&gt;
Sun ...............&lt;/P&gt;

&lt;P&gt;As per the previous query we could able to add week days but now we want to add days corresponding to each week day&lt;/P&gt;</description>
      <pubDate>Sun, 21 May 2017 18:50:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372863#M109641</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-21T18:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372864#M109642</link>
      <description>&lt;P&gt;OK, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="Mon 1::Tue 2::Sat 3" 
| makemv delim="::" raw 
| mvexpand raw 
| rex field=raw "^(?&amp;lt;Day&amp;gt;\S+)\s+(?&amp;lt;count&amp;gt;\S+)$" 
| fields - _time raw 
| rename COMMENT AS "Everything above fakes sample (intermediate) data; everything below is your solution"
| rename COMMENT AS "YOUR EXISTING SEARCH HERE"
| append 
    [| makeresults count=7 
    | streamstats count AS serial 
    | eval serial = serial - 1
    | eval Day=case(serial=0, "Sun", serial=1, "Mon", serial=2, "Tue", serial=3, "Wed", serial=4, "Thu", serial=5, "Fri", serial=6, "Sat", true(), "N/A")
    | eval time = relative_time(now(), "@w") + (serial  * 60 * 60 * 24)
    | eval count=0]
| stats sum(count) AS count first(serial) AS serial first(time) AS Day_Detail BY Day
| sort 0 serial
| fields - serial
| eval count=if(count=0, null(), count)
| filldown count
| fillnull count value="0"
| fieldformat Day_Detail = strftime(Day_Detail, "%a %b %d %Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It may not be exactly perfect but it has all the moving parts that you should need to massage it to your needs.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 00:00:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372864#M109642</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-23T00:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search for continuous day count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372865#M109643</link>
      <description>&lt;P&gt;|gentimes start=-7 -- it looks for last 7 days.&lt;/P&gt;

&lt;P&gt;I want to update start time like earliest time&lt;/P&gt;

&lt;P&gt;ex: earliest=-w@w latest=@w, usually it will fetch the records for last week, &lt;/P&gt;

&lt;P&gt;How can i pass these earliest and latest values to gentimes start =-w@w end=@w&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 14:19:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-a-search-for-continuous-day-count/m-p/372865#M109643</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2017-05-31T14:19:46Z</dc:date>
    </item>
  </channel>
</rss>

