<?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 How could I append the subsearch result with different fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-append-the-subsearch-result-with-different-fields/m-p/137553#M37710</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to combine two searches into one table with different fields name. for example, I have error source file A, have the filed errorcode with "codeA, codeB, codeC...", source file B have all the successful transaction records with the field name transnum, I want to have a table with the error count split by error code, and the  total successful transactions count.  The format is like this:&lt;/P&gt;

&lt;P&gt;codeA                                                               xx&lt;BR /&gt;
codeB                                                                xx&lt;BR /&gt;
codeC                                                                xx&lt;BR /&gt;
transactions                                              xx&lt;/P&gt;

&lt;P&gt;I tried the search:&lt;/P&gt;

&lt;P&gt;source=A | stats count by errorcode | append [ search source=B | stats count(transnum) by count ]&lt;/P&gt;

&lt;P&gt;The total transaction count will show at the last line, but the name column is empty.&lt;BR /&gt;
errorcode                                                count&lt;BR /&gt;
codeA                                                             xx&lt;BR /&gt;
codeB                                                             xx&lt;BR /&gt;
codeC                                                            xx&lt;BR /&gt;
                                                                    xx&lt;/P&gt;

&lt;P&gt;How could I add the name "transactions" to the last row of the search result?&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jun 2015 20:06:44 GMT</pubDate>
    <dc:creator>jpeng5068</dc:creator>
    <dc:date>2015-06-05T20:06:44Z</dc:date>
    <item>
      <title>How could I append the subsearch result with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-append-the-subsearch-result-with-different-fields/m-p/137553#M37710</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to combine two searches into one table with different fields name. for example, I have error source file A, have the filed errorcode with "codeA, codeB, codeC...", source file B have all the successful transaction records with the field name transnum, I want to have a table with the error count split by error code, and the  total successful transactions count.  The format is like this:&lt;/P&gt;

&lt;P&gt;codeA                                                               xx&lt;BR /&gt;
codeB                                                                xx&lt;BR /&gt;
codeC                                                                xx&lt;BR /&gt;
transactions                                              xx&lt;/P&gt;

&lt;P&gt;I tried the search:&lt;/P&gt;

&lt;P&gt;source=A | stats count by errorcode | append [ search source=B | stats count(transnum) by count ]&lt;/P&gt;

&lt;P&gt;The total transaction count will show at the last line, but the name column is empty.&lt;BR /&gt;
errorcode                                                count&lt;BR /&gt;
codeA                                                             xx&lt;BR /&gt;
codeB                                                             xx&lt;BR /&gt;
codeC                                                            xx&lt;BR /&gt;
                                                                    xx&lt;/P&gt;

&lt;P&gt;How could I add the name "transactions" to the last row of the search result?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2015 20:06:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-append-the-subsearch-result-with-different-fields/m-p/137553#M37710</guid>
      <dc:creator>jpeng5068</dc:creator>
      <dc:date>2015-06-05T20:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: How could I append the subsearch result with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-append-the-subsearch-result-with-different-fields/m-p/137554#M37711</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/eval"&gt;eval&lt;/A&gt; lets you set fields to &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/CommonEvalFunctions"&gt;calculations&lt;/A&gt; or to fixed arbitrary values. Use it within your appended search, and you should be all set:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=A | stats count by errorcode | append [ search source=B | stats count(transnum) as count | eval errorcode="transactions" ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jun 2015 20:27:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-append-the-subsearch-result-with-different-fields/m-p/137554#M37711</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-06-05T20:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: How could I append the subsearch result with different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-append-the-subsearch-result-with-different-fields/m-p/137555#M37712</link>
      <description>&lt;P&gt;That works, Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 19:02:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-append-the-subsearch-result-with-different-fields/m-p/137555#M37712</guid>
      <dc:creator>jpeng5068</dc:creator>
      <dc:date>2015-06-09T19:02:39Z</dc:date>
    </item>
  </channel>
</rss>

