<?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 days without events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320441#M95767</link>
    <description>&lt;P&gt;This works great, thank you very much!&lt;/P&gt;</description>
    <pubDate>Fri, 06 Apr 2018 05:29:36 GMT</pubDate>
    <dc:creator>bntdumas</dc:creator>
    <dc:date>2018-04-06T05:29:36Z</dc:date>
    <item>
      <title>Count days without events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320437#M95763</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to get the sum of days where no events occurred by a city name.&lt;/P&gt;

&lt;P&gt;I found the following answer (&lt;A href="https://answers.splunk.com/answers/29371/find-days-with-no-events.html"&gt;https://answers.splunk.com/answers/29371/find-days-with-no-events.html&lt;/A&gt;) that uses timechart to handle days without events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=foo | timechart count span=1d by city
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which gives me the following table:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="table"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4721i4F71DBA7A559E2CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="table" alt="table" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I feel like I'm getting closer to the solution but what i would like is to know how many days don't have events, in our example that would be:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4722i6DF626315EFFBB00/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;How could I solve this? &lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;BR /&gt;
Benoit&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 05:47:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320437#M95763</guid>
      <dc:creator>bntdumas</dc:creator>
      <dc:date>2018-04-05T05:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count days without events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320438#M95764</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|where count=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Append this to your query and try&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 05:52:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320438#M95764</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2018-04-05T05:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count days without events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320439#M95765</link>
      <description>&lt;P&gt;try putting this at the end of your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|foreach * [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;_0=if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'=0,1,0)|fields - date_0]|appendpipe [|stats sum(*_0) as *|eval date="Days at 0"]|fields - *_0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that'll add a line at the bottom of your table for the sum of all 0 days. or you could leave the &lt;CODE&gt;appendpipe []&lt;/CODE&gt; out of it and just use the &lt;CODE&gt;|foreach * [....]|stats...&lt;/CODE&gt; to only bring in the Days at 0&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 12:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320439#M95765</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-04-05T12:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Count days without events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320440#M95766</link>
      <description>&lt;P&gt;Unfortunately this works only when the timechart is not sorted "by city" and returns nothing otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 05:29:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320440#M95766</guid>
      <dc:creator>bntdumas</dc:creator>
      <dc:date>2018-04-06T05:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count days without events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320441#M95767</link>
      <description>&lt;P&gt;This works great, thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 05:29:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-days-without-events/m-p/320441#M95767</guid>
      <dc:creator>bntdumas</dc:creator>
      <dc:date>2018-04-06T05:29:36Z</dc:date>
    </item>
  </channel>
</rss>

