<?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: Can you make append not start on a new line? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335905#M170364</link>
    <description>&lt;P&gt;It will always do that, but this will give you what you want:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex 
| stats count AS Total1 BY host 
| append 
 [ search index=myindex 
  | stats count AS Total2 BY source]
| stats max(Total1) AS Total1 max(Total2) AS Total2 by host, source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 13 Apr 2018 23:15:21 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2018-04-13T23:15:21Z</dc:date>
    <item>
      <title>Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335904#M170363</link>
      <description>&lt;P&gt;LIke if I run this query:&lt;/P&gt;

&lt;P&gt;index=myindex | stats count AS Total1 BY host | append [ search index=myindex | stats count AS Total2 BY source]&lt;/P&gt;

&lt;P&gt;I want the statistics for Total2 to be on the same line as Total1, or am I just using the wrong command?&lt;/P&gt;

&lt;P&gt;I just want to make two search queries of the same index to be able to compare them on the statistics tab.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 21:18:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335904#M170363</guid>
      <dc:creator>summitsplunk</dc:creator>
      <dc:date>2018-04-13T21:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335905#M170364</link>
      <description>&lt;P&gt;It will always do that, but this will give you what you want:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex 
| stats count AS Total1 BY host 
| append 
 [ search index=myindex 
  | stats count AS Total2 BY source]
| stats max(Total1) AS Total1 max(Total2) AS Total2 by host, source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Apr 2018 23:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335905#M170364</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-04-13T23:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335906#M170365</link>
      <description>&lt;P&gt;@summitsplunk, depends on what is your use case and what is the required output.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal log_level=* sourcetype=*
| stats count AS Total1 BY log_level 
| append 
    [ search index=_internal 
    | stats count AS Total2 BY sourcetype] 
| fillnull value="-"  
| stats max(Total1) AS Total1 max(Total2) AS Total2 by log_level, sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal log_level=* sourcetype=*
| stats count AS Total BY log_level 
| rename log_level as Field
| append 
    [ search index=_internal 
    | stats count AS Total BY sourcetype
    | rename sourcetype as Field]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal log_level=* sourcetype=*
| stats count AS Total BY log_level, sourcetype
| eventstats sum(Total) as Total_log_level by log_level
| eventstats sum(Total) as Total_sourcetype by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal log_level=* sourcetype=*
| stats count AS Total BY log_level, sourcetype
| chart last(Total) as Total by log_level sourcetype
| fillnull value=0
| addtotals col=t row=t labelfield=log_level label=Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See if one of them fits your needs.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Apr 2018 09:26:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335906#M170365</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-14T09:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335907#M170366</link>
      <description>&lt;P&gt;@elliotproebstel, you should have fillnull to ensure null fields are still accounted in the final stats &lt;CODE&gt;| fillnull value="-"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Apr 2018 09:28:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335907#M170366</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-14T09:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335908#M170367</link>
      <description>&lt;P&gt;Hi instead of append,try join&lt;/P&gt;

&lt;P&gt;index=a&lt;BR /&gt;
|stats count by host&lt;BR /&gt;
|join type=left/inner host&lt;BR /&gt;
[search index=b&lt;BR /&gt;
|stats count by host]&lt;/P&gt;</description>
      <pubDate>Sat, 14 Apr 2018 13:37:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335908#M170367</guid>
      <dc:creator>Kirantcs</dc:creator>
      <dc:date>2018-04-14T13:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335909#M170368</link>
      <description>&lt;P&gt;Nice correction, thanks! &lt;/P&gt;</description>
      <pubDate>Sat, 14 Apr 2018 16:45:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335909#M170368</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-04-14T16:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335910#M170369</link>
      <description>&lt;P&gt;Thanks everyone. All were good ideas but they only let me accept one answer. &lt;/P&gt;</description>
      <pubDate>Sat, 14 Apr 2018 17:56:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335910#M170369</guid>
      <dc:creator>summitsplunk</dc:creator>
      <dc:date>2018-04-14T17:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can you make append not start on a new line?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335911#M170370</link>
      <description>&lt;P&gt;@summitsplunk, since you have already up-voted the remaining answers, you have done your part. Glad you could find the answers useful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Apr 2018 18:53:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-make-append-not-start-on-a-new-line/m-p/335911#M170370</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-14T18:53:54Z</dc:date>
    </item>
  </channel>
</rss>

