<?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 format stats table results as rows of strings without column headers? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184297#M53098</link>
    <description>&lt;P&gt;I'm getting these results so it's still out order for me for some reason.&lt;/P&gt;

&lt;P&gt;ACCOUNT'S HAD CALL POPS 36906 1&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 8714 2&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 1729 3&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 512 4&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 155 5&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 57 6&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jul 2015 19:34:32 GMT</pubDate>
    <dc:creator>kmccowen</dc:creator>
    <dc:date>2015-07-01T19:34:32Z</dc:date>
    <item>
      <title>How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184285#M53086</link>
      <description>&lt;P&gt;Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ctap host=sc58* sourcetype=gateway "CTIPOP CALL RECEIVED" acct="*" | stats count by acct | eventstats count as sum by count | fields sum,index,count,sourcetype| eval index="ACCOUNT'S HAD"| eval sourcetype="CALL POPS" |rename sum as "NUMBER OF ACCOUNT'S"| rename index as "INFO_1"| rename sourcetype as "INFO_2"|  rename count as "NUMBER OF CALLS"| dedup  "NUMBER OF CALLS" | sort  "NUMBER OF CALLS"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Current output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     NUMBER OF ACCOUNT'S   INFO_1         NUMBER OF CALLS    INFO_2
1   48024                ACCOUNT'S HAD   1                CALL POPS
2   13460                ACCOUNT'S HAD   2                CALL POPS
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to figure out a way to turn the above stats into a single string per line without headers.  I'm being asked to create this panel to look like text so that each line reads like a complete sentence.  I've been unable to figure anything out.  Is this even possible?&lt;/P&gt;

&lt;P&gt;Desired output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1   48024  ACCOUNT'S HAD 1 CALL POPS
2   13460  ACCOUNT'S HAD 2 CALL POPS     
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 14:45:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184285#M53086</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2015-06-30T14:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184286#M53087</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ctap host=sc58* sourcetype=gateway "CTIPOP CALL RECEIVED" acct="*" | stats count by acct | eventstats count as sum by count | fields sum,index,count,sourcetype| eval index="ACCOUNT'S HAD"| eval sourcetype="CALL POPS" |rename sum as "NUMBER OF ACCOUNT'S"| rename index as "INFO_1"| rename sourcetype as "INFO_2"| rename count as "NUMBER OF CALLS"| dedup "NUMBER OF CALLS" | sort "NUMBER OF CALLS" | foreach * [eval combo=combo . " " . &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;] | fields combo
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 16:15:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184286#M53087</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T16:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184287#M53088</link>
      <description>&lt;P&gt;Woodcock,&lt;BR /&gt;
When I run this I get a blank set of results with a header of Combo :(.  Maybe i'm on a different version of splunk?  I'm on 6.2.2&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 17:18:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184287#M53088</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2015-06-30T17:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184288#M53089</link>
      <description>&lt;P&gt;You are correct; it &lt;EM&gt;should&lt;/EM&gt; work but doesn't; try this variation:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ctap host=sc58* sourcetype=gateway "CTIPOP CALL RECEIVED" acct="*" | stats count by acct | eventstats count as sum by count | fields sum,index,count,sourcetype| eval index="ACCOUNT'S HAD"| eval sourcetype="CALL POPS" |rename sum as "NUMBER OF ACCOUNT'S"| rename index as "INFO_1"| rename sourcetype as "INFO_2"| rename count as "NUMBER OF CALLS"| dedup "NUMBER OF CALLS" | sort "NUMBER OF CALLS" | foreach * [eval combo = mvappend(combo, $&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;$)] | eval combo=mvjoin(combo," ") | table combo
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 18:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184288#M53089</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T18:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184289#M53090</link>
      <description>&lt;P&gt;Much better but the count and sums are out of sequence.  Below is the output i'm getting.&lt;/P&gt;

&lt;P&gt;combo&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 48024 1&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 13460 2&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 2883 3&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 914 4&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 18:11:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184289#M53090</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2015-06-30T18:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184290#M53091</link>
      <description>&lt;P&gt;Also, to further "vaguify" your table, you can rename &lt;CODE&gt;combo&lt;/CODE&gt; to something that looks like a divider by adding this to the end:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rename combo AS "---------------------------------------------------------"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 18:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184290#M53091</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T18:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184291#M53092</link>
      <description>&lt;P&gt;OK, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ctap host=sc58* sourcetype=gateway "CTIPOP CALL RECEIVED" acct="*" | stats count by acct | eventstats count as sum by count | fields sum,index,count,sourcetype| eval index="ACCOUNT'S HAD"| eval sourcetype="CALL POPS" |rename sum as "NUMBER OF ACCOUNT'S"| rename index as "INFO_1"| rename sourcetype as "INFO_2"| rename count as "NUMBER OF CALLS"| dedup "NUMBER OF CALLS" | sort "NUMBER OF CALLS" | foreach * [eval combo = mvappend(combo, $&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;$)] | eval combo2=mvjoin(combo," ") | table combo2 | rename combo2 AS "---------------------------------------------------------"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jun 2015 18:30:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184291#M53092</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T18:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184292#M53093</link>
      <description>&lt;P&gt;I get the error "Error in 'foreach' command: arguments must contain at least one field specifier"&lt;/P&gt;

&lt;P&gt;I added an * after the foreach command but then I get "no results found"&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 18:34:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184292#M53093</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2015-06-30T18:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184293#M53094</link>
      <description>&lt;P&gt;ARGH!  Retry (markdown got me but I re-edited it).&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 18:38:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184293#M53094</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T18:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184294#M53095</link>
      <description>&lt;P&gt;Running this query:&lt;BR /&gt;
index=ctap host=sc58* sourcetype=gateway "CTIPOP CALL RECEIVED" acct="*" | stats count by acct | eventstats count as sum by count | fields sum,index,count,sourcetype| eval index="ACCOUNT'S HAD"| eval sourcetype="CALL POPS" |rename sum as "NUMBER OF ACCOUNT'S"| rename index as "INFO_1"| rename sourcetype as "INFO_2"| rename count as "NUMBER OF CALLS"| dedup "NUMBER OF CALLS" | sort "NUMBER OF CALLS" | foreach * [eval combo = mvappend(combo, $&amp;lt;&amp;gt;$)] | eval combo2=mvjoin(combo," ") | table combo2&lt;/P&gt;

&lt;P&gt;Getting "no results found"  &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:25:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184294#M53095</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2020-09-28T20:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184295#M53096</link>
      <description>&lt;P&gt;If I remove the table command at the end, I get the same results I was getting before with the headers.&lt;/P&gt;

&lt;P&gt;NUMBER OF ACCOUNT'S INFO_1  NUMBER OF CALLS INFO_2&lt;BR /&gt;
34866   ACCOUNT'S HAD   1   CALL POPS&lt;BR /&gt;
8805    ACCOUNT'S HAD   2   CALL POPS&lt;BR /&gt;
1782    ACCOUNT'S HAD   3   CALL POPS&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:25:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184295#M53096</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2020-09-28T20:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184296#M53097</link>
      <description>&lt;P&gt;The comment chain is getting pretty deep so I am pulling back out to a fresh answer:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ctap host=sc58* sourcetype=gateway "CTIPOP CALL RECEIVED" acct="*" | stats count by acct | eventstats count as sum by count | fields sum,index,count,sourcetype| eval index="ACCOUNT'S HAD"| eval sourcetype="CALL POPS" |rename sum as "NUMBER OF ACCOUNT'S"| rename index as "INFO_1"| rename sourcetype as "INFO_2"| rename count as "NUMBER OF CALLS"| dedup "NUMBER OF CALLS" | sort "NUMBER OF CALLS" | foreach * [eval combo = mvappend(combo, $&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;$)] | eval combo2=mvjoin(combo," ") | table combo2 | rename combo2 AS "---------------------------------------------------------"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The difference is that when I use a single field &lt;CODE&gt;combo&lt;/CODE&gt; for both input and output, Splunk is sorting the &lt;CODE&gt;mvappend&lt;/CODE&gt; but when I do it with 2 fields with &lt;CODE&gt;combo&lt;/CODE&gt; as input and &lt;CODE&gt;combo2&lt;/CODE&gt; as output, the &lt;CODE&gt;mvappend&lt;/CODE&gt; is not sorted.  So the above should work for you (it does for me).&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 21:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184296#M53097</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-30T21:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184297#M53098</link>
      <description>&lt;P&gt;I'm getting these results so it's still out order for me for some reason.&lt;/P&gt;

&lt;P&gt;ACCOUNT'S HAD CALL POPS 36906 1&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 8714 2&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 1729 3&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 512 4&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 155 5&lt;BR /&gt;
ACCOUNT'S HAD CALL POPS 57 6&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 19:34:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184297#M53098</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2015-07-01T19:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184298#M53099</link>
      <description>&lt;P&gt;I think you could use a much simpler query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ctap host=sc58* sourcetype=gateway "CTIPOP CALL RECEIVED" acct="*" 
| stats count by acct | stats count as sum by count
| eval message=sum." ACCOUNTS HAD ".count." CALL POPS"
| sort count | table message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first two lines, are your original base query to calculate the number of accounts that called each of how many times.&lt;BR /&gt;
The third line we use &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Eval"&gt;eval&lt;/A&gt; to concatenate the fields together into a message&lt;BR /&gt;
The fourth line we sort our result lines based on count (assuming this is the sort you want), and then throw away all fields other than our built message.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 19:35:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184298#M53099</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-07-01T19:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184299#M53100</link>
      <description>&lt;P&gt;You were right, this worked!  Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 20:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184299#M53100</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2015-07-01T20:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184300#M53101</link>
      <description>&lt;P&gt;Glad I could help @kmccowen! Also not sure if you're aware of this, but instead of using the "award points" link (which deducts from your answers karma) if you feel an answer, question, or comment is particularly good, you can use the upvote button (^) instead. Doing so awards karma to whomever helped you out, while keeping your karma intact, and helps with rankings of content too. I've awarded you the 20 karma that you gave away in this manner.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 20:41:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184300#M53101</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-07-01T20:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to format stats table results as rows of strings without column headers?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184301#M53102</link>
      <description>&lt;P&gt;For everyone's benefit here... the reason the fields are coming out in the wrong order here, and for the previous attempts is the &lt;CODE&gt;foreach * []&lt;/CODE&gt; part. Listing a number of fields using &lt;CODE&gt;*&lt;/CODE&gt; means the fields are processed in alphabetical order. With the fields that you had at that point, this means that you would append to the combo field in order the fields &lt;CODE&gt;INFO_1&lt;/CODE&gt; &lt;CODE&gt;INFO_2&lt;/CODE&gt; &lt;CODE&gt;NUMBER OF ACCOUNT'S&lt;/CODE&gt; &lt;CODE&gt;NUMBER OF CALLS&lt;/CODE&gt;. Now yes you could explicitly list the fields in the order you want, but if you're going through that much trouble, it'd becomes easier to just explicitly append the fields together.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 20:47:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-stats-table-results-as-rows-of-strings-without/m-p/184301#M53102</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-07-01T20:47:27Z</dc:date>
    </item>
  </channel>
</rss>

