<?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 edit my search to display appendcols subsearch results, even if the main search returns no events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203206#M59038</link>
    <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = enterprise_idx1 sourcetype = sft 
| dedup _time, BatchId 
| search BatchStatus = C4 
| timechart span="1d" dc(BatchId) as "Successful" 
| append [search index = enterprise_idx1 sourcetype = sft
| dedup _time, BatchId 
| search BatchStatus = E1 OR BatchStatus = E2 OR BatchStatus = E3 OR BatchStatus = E4
| timechart span="1d" dc(BatchId) as "Errored"]
|stats values(Successful) as Successful values(Errored) as Errored by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 20 Dec 2016 17:19:50 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2016-12-20T17:19:50Z</dc:date>
    <item>
      <title>How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203205#M59037</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;

&lt;P&gt;I have a search as below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = enterprise_idx1 sourcetype = sft   
| dedup _time, BatchId  
| search BatchStatus = C4   
| timechart span="1d" dc(BatchId) as "Successful"   
| appendcols [search index = enterprise_idx1 sourcetype = sft
| dedup _time, BatchId  
| search BatchStatus = E1 OR BatchStatus = E2 OR BatchStatus = E3 OR BatchStatus = E4
| timechart span="1d" dc(BatchId) as "Errored"]   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The query works fine when I have data for both successful and error.&lt;BR /&gt;
But if I do not have data for successful (as per the above query), the error data is also not displayed.&lt;BR /&gt;
In short, if the first part of the query does not return any rows, then the appendcols part is also not displayed.&lt;/P&gt;

&lt;P&gt;Is there any way this can be handled?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Nirmalya&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 17:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203205#M59037</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2016-12-20T17:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203206#M59038</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = enterprise_idx1 sourcetype = sft 
| dedup _time, BatchId 
| search BatchStatus = C4 
| timechart span="1d" dc(BatchId) as "Successful" 
| append [search index = enterprise_idx1 sourcetype = sft
| dedup _time, BatchId 
| search BatchStatus = E1 OR BatchStatus = E2 OR BatchStatus = E3 OR BatchStatus = E4
| timechart span="1d" dc(BatchId) as "Errored"]
|stats values(Successful) as Successful values(Errored) as Errored by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Dec 2016 17:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203206#M59038</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-12-20T17:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203207#M59039</link>
      <description>&lt;P&gt;Nopes.. It doesn't work. Same as before. &lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 17:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203207#M59039</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2016-12-20T17:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203208#M59040</link>
      <description>&lt;P&gt;that's odd, I ran that on some of my data and it works. The first bit of data I made sure returned no results and I appended a search with results. I get a table with _time Successful (which has no values) and Errored&lt;BR /&gt;
Does the Errored subsearch have data?&lt;/P&gt;

&lt;P&gt;if Errors doesn't have data, perhaps add this so you know:&lt;BR /&gt;
| appendpipe [ stats count | eval "Errored"="No Results Found"  | where count==0 |table "Errored"]&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 17:50:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203208#M59040</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-12-20T17:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203209#M59041</link>
      <description>&lt;P&gt;Just found something odd too.&lt;BR /&gt;
I was actually having the below query appended for tracking datetime from input parameters on the dashboard.&lt;/P&gt;

&lt;P&gt;| addinfo&lt;BR /&gt;&lt;BR /&gt;
| eval info_max_time=if (info_max_time="+Infinity",9999999999,info_max_time)&lt;BR /&gt;&lt;BR /&gt;
| where _time &amp;gt;= info_min_time AND _time &amp;lt; info_max_time&lt;BR /&gt;&lt;BR /&gt;
| fields - info*&lt;/P&gt;

&lt;P&gt;So if I remove this part, then the query works fine. But with this appended it does not work.&lt;BR /&gt;
What can be the issue with this addinfo part&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:11:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203209#M59041</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2020-09-29T12:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203210#M59042</link>
      <description>&lt;P&gt;@cmerriman &lt;BR /&gt;
Can you please try this with your data. I am attaching the full query that I have in the dashboard.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = enterprise_idx1 sourcetype = sft 
| dedup _time, BatchId 
| search BatchStatus = C4 
| timechart span="1d" dc(BatchId) as "Successful" 
| appendcols [search index = enterprise_idx1 sourcetype = sft
| dedup _time, BatchId 
| search BatchStatus = E1 OR BatchStatus = E2 OR BatchStatus = E3 OR BatchStatus = E4
| timechart span="1d" dc(BatchId) as "Errored"] 
| addinfo 
| eval info_max_time=if (info_max_time="+Infinity",9999999999,info_max_time) 
| where _time &amp;gt;= info_min_time AND _time &amp;lt; info_max_time 
| fields - info*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first part of the query should have no data but the second part must have some data.&lt;BR /&gt;
Please see if you are also getting  "No results Found"&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 18:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203210#M59042</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2016-12-20T18:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203211#M59043</link>
      <description>&lt;P&gt;the problem is because you don't have a _time field that is populated, I assume. When I run the first part without the &lt;CODE&gt;|addinfo&lt;/CODE&gt;, I don't get anything populated under _time because there were no Successful events. &lt;/P&gt;

&lt;P&gt;I tried this and I got data back: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index = enterprise_idx1 sourcetype = sft 
 | dedup _time, BatchId 
 | search BatchStatus = C4 
 | timechart span="1d" dc(BatchId) as "Successful" 
 | append [search index = enterprise_idx1 sourcetype = sft
 | dedup _time, BatchId 
 | search BatchStatus = E1 OR BatchStatus = E2 OR BatchStatus = E3 OR BatchStatus = E4
 | timechart span="1d" dc(BatchId) as "Errored"]
 |stats values(Successful) as Successful values(Errored) as Errored by _time
 | addinfo 
 | eval info_max_time=if (info_max_time="+Infinity",9999999999,info_max_time) 
 | where _time &amp;gt;= info_min_time AND _time &amp;lt; info_max_time 
 | fields - info*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Dec 2016 19:04:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203211#M59043</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-12-20T19:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to display appendcols subsearch results, even if the main search returns no events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203212#M59044</link>
      <description>&lt;P&gt;Ya this worked fine.&lt;BR /&gt;
It seems replacing "appendcols" with "append" is working.&lt;BR /&gt;
Also this didn't need the "|stats".&lt;BR /&gt;
But it needs the |addinfo&lt;/P&gt;

&lt;P&gt;@cmerriman&lt;BR /&gt;
Please convert your comment to Answer. I will accept it for all others who are following this Topic&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 20:48:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-display-appendcols-subsearch-results/m-p/203212#M59044</guid>
      <dc:creator>nirmalya2006</dc:creator>
      <dc:date>2016-12-20T20:48:41Z</dc:date>
    </item>
  </channel>
</rss>

