<?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 do I append a specific field with specific values an counts to &amp;quot;no results&amp;quot; search results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439597#M125047</link>
    <description>&lt;P&gt;@williamcharlton0028,&lt;/P&gt;

&lt;P&gt;Try adding this to your search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| append 
    [| stats count 
    | eval Type ="Critical,Error"
    | makemv Type delim=","
    | mvexpand Type ]
| stats max(count) as count by Type 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Mar 2019 15:06:33 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2019-03-13T15:06:33Z</dc:date>
    <item>
      <title>How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439595#M125045</link>
      <description>&lt;P&gt;I've read about the many ways to have a dashboard panel show something other than "No results found", but none of them meet my goal. If  the search on my panel yields no events, what I want to do is to construct the same output that would typically appear, the only difference being that the &lt;CODE&gt;count&lt;/CODE&gt; attribute of each field value will be 0.&lt;/P&gt;

&lt;P&gt;Details: The final piece of my search is &lt;CODE&gt;....  AND (Type = "Critical" OR Type = "Error") | stats count by Type&lt;/CODE&gt;. So, if events are returned, and there is at least one each &lt;CODE&gt;Critical&lt;/CODE&gt; and &lt;CODE&gt;Error&lt;/CODE&gt;, then I'll see one field &lt;CODE&gt;(Type)&lt;/CODE&gt; with two values &lt;CODE&gt;(Critical and Error)&lt;/CODE&gt;. The count attribute for each value is some positive, non-zero value, e.g., if there are 5 &lt;CODE&gt;Critical&lt;/CODE&gt; and 6 &lt;CODE&gt;Error&lt;/CODE&gt;, then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Type       count
Critical   5
Error      6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, how do I use, e.g.,  &lt;CODE&gt;append&lt;/CODE&gt; or &lt;CODE&gt;appendpipe&lt;/CODE&gt; to produce field &lt;CODE&gt;Type&lt;/CODE&gt; with value &lt;CODE&gt;Critical&lt;/CODE&gt;, count=0 and value &lt;CODE&gt;Error&lt;/CODE&gt;, count = 0?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Type       count
Critical   0
Error      0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 14:41:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439595#M125045</guid>
      <dc:creator>williamcharlton</dc:creator>
      <dc:date>2019-03-13T14:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439596#M125046</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... AND (Type = "Critical" OR Type = "Error") | stats count by Type
| appendpipe [| stats count | where count=0 | eval Type="Critical Error" | makemv Type | mvexpand Type]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:06:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439596#M125046</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-03-13T15:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439597#M125047</link>
      <description>&lt;P&gt;@williamcharlton0028,&lt;/P&gt;

&lt;P&gt;Try adding this to your search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| append 
    [| stats count 
    | eval Type ="Critical,Error"
    | makemv Type delim=","
    | mvexpand Type ]
| stats max(count) as count by Type 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:06:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439597#M125047</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-03-13T15:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439598#M125048</link>
      <description>&lt;P&gt;Hi @williamcharlton0028&lt;/P&gt;

&lt;P&gt;Try like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yourquery| stats count by Type 
| appendpipe 
 [| stats count 
 | where count=0 
 | eval Type="Critical",count=0 
 | appendpipe 
     [| eval Type="Error",count=0]]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:11:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439598#M125048</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-13T15:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439599#M125049</link>
      <description>&lt;P&gt;@vnravikumar works well except that it appends unconditionally, i.e., in my dashboard panel, when results are returned, I have two &lt;CODE&gt;Critical&lt;/CODE&gt; values (&amp;gt;0 and 0) and two &lt;CODE&gt;Error&lt;/CODE&gt; values (&amp;gt;0 and 0). Should append only when query returns no results. I see the &lt;CODE&gt;| where count==0&lt;/CODE&gt; but its apparently not working&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439599#M125049</guid>
      <dc:creator>williamcharlton</dc:creator>
      <dc:date>2019-03-13T15:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439600#M125050</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| appendpipe 
    [| stats count 
    | where count=0 
    | eval Type="Critical",count=0 
    | appendpipe 
        [| eval Type="Error",count=0]]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Mar 2019 15:57:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439600#M125050</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-13T15:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439601#M125051</link>
      <description>&lt;P&gt;@vnravikumar That did it. So, you changed it so that &lt;CODE&gt;| eval Type="Critical",count=0 | appendpipe [| eval Type="Error",count=0]&lt;/CODE&gt; is performed only when count == 0. I see - thank -you&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:06:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439601#M125051</guid>
      <dc:creator>williamcharlton</dc:creator>
      <dc:date>2019-03-13T16:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439602#M125052</link>
      <description>&lt;P&gt;if resolved, please accept.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:11:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439602#M125052</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-13T16:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439603#M125053</link>
      <description>&lt;P&gt;@ vnravikumar: accepted. Please update your original answer for future viewers?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:28:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439603#M125053</guid>
      <dc:creator>williamcharlton</dc:creator>
      <dc:date>2019-03-13T16:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I append a specific field with specific values an counts to "no results" search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439604#M125054</link>
      <description>&lt;P&gt;thanks. I had updated&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 16:31:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-append-a-specific-field-with-specific-values-an-counts/m-p/439604#M125054</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-13T16:31:17Z</dc:date>
    </item>
  </channel>
</rss>

