<?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: Stats for exception reporting in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-for-exception-reporting/m-p/121350#M32655</link>
    <description>&lt;P&gt;Thank you Nick!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2013 00:58:59 GMT</pubDate>
    <dc:creator>lukeh</dc:creator>
    <dc:date>2013-10-30T00:58:59Z</dc:date>
    <item>
      <title>Stats for exception reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-for-exception-reporting/m-p/121348#M32653</link>
      <description>&lt;P&gt;Hi &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I am trying to setup some exception reports for our capacity planners and I can construct a search that generates a table, eg.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;          _time                  is_match    count
1    25/10/2013 00:00:00.000     Breach      1
2    26/10/2013 00:00:00.000     Breach      1
3    27/10/2013 00:00:00.000     Breach      1
4    22/10/2013 00:00:00.000     Prediction  1
5    23/10/2013 00:00:00.000     Prediction  1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I ultimately want is a count of "Breach" and the first time that "Prediction" occurred, eg.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Count     Time
3         22/10/2013 00:00:00.000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is this possible with just one stats command?&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;

&lt;P&gt;Luke.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2013 00:12:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-for-exception-reporting/m-p/121348#M32653</guid>
      <dc:creator>lukeh</dc:creator>
      <dc:date>2013-10-30T00:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Stats for exception reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-for-exception-reporting/m-p/121349#M32654</link>
      <description>&lt;P&gt;This is the best approach I can think of: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;your search that returns _time, count and is_match&amp;gt;
| eval foo="1" 
| chart min(_time) sum(count) as count over foo by is_match 
| rename "count: Breach" as Count "min(_time): Prediction" as Time 
| fields Count Time 
| eval Time=strftime(Time,"%d/%m/%Y %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;foo="1"&lt;/CODE&gt; trick is useful surprisingly often to trick the chart command into doing the "by" part without the "over" part.  At the end you always throw the &lt;CODE&gt;foo&lt;/CODE&gt; away.  Here our &lt;CODE&gt;foo&lt;/CODE&gt; dies a quiet death when we get to &lt;CODE&gt;fields Count Time&lt;/CODE&gt;.  &lt;/P&gt;

&lt;P&gt;Aside from that we rely on the functionality in chart and timechart to do more than one split-by field - it ends up combining them as "valueN: valueM" across the columns and here we use that to get both our Breach count and our Prediction time in one row, and then we rename the strange colon-separated syntax away. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2013 00:55:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-for-exception-reporting/m-p/121349#M32654</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-10-30T00:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Stats for exception reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-for-exception-reporting/m-p/121350#M32655</link>
      <description>&lt;P&gt;Thank you Nick!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2013 00:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-for-exception-reporting/m-p/121350#M32655</guid>
      <dc:creator>lukeh</dc:creator>
      <dc:date>2013-10-30T00:58:59Z</dc:date>
    </item>
  </channel>
</rss>

