<?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 you format numbers produced by 'count over'? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40374#M9301</link>
    <description>&lt;P&gt;I've just stubmled across ctable, which may even be better than xyseries:&lt;/P&gt;

&lt;P&gt;sourcetype="access_common"| ctable uri_path host | sort TOTAL DESC&lt;/P&gt;

&lt;P&gt;I end up with a table like I was getting from my original 'chart' search with the addition of a grand total column.&lt;/P&gt;

&lt;P&gt;Here again, I can't figure out what to pipe the results to or through to format the numbers in the series columns.  This pipe does format the grand dotal column:&lt;/P&gt;

&lt;P&gt;|  fieldFormat TOTAL=tostring(TOTAL,"commas") &lt;/P&gt;

&lt;P&gt;If I address a data column by the name Splunk gives it, the data is all set to empty.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 10:14:55 GMT</pubDate>
    <dc:creator>dpadams</dc:creator>
    <dc:date>2020-09-28T10:14:55Z</dc:date>
    <item>
      <title>How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40367#M9294</link>
      <description>&lt;P&gt;I've got a collection of Web log data where we like to see the URLs counted by host:&lt;/P&gt;

&lt;P&gt;sourcetype="access_common" | chart count over uri_path by host&lt;/P&gt;

&lt;P&gt;We've got a couple of different server types handling different sorts of URLs, so the table we get out of this query is a helpful way to see the URLs-by-machine very easily. You get a table with the uri_path (URL) listed in the left-hand column and then one column for each of our servers. So:&lt;/P&gt;

&lt;P&gt;uri_path              Server_1      Server_2&lt;BR /&gt;
/action/do_this          897       12345&lt;BR /&gt;
/action/do_that      23456       18001&lt;/P&gt;

&lt;P&gt;The "Server_1" and "Server_2" names are extracted from the host field for the event and the counts are calculated by Splunk.&lt;/P&gt;

&lt;P&gt;Can anyone tell me how to format the resulting numbers? Ideally, I'd like to use commas in large numbers and put a - or an empty string for zeros. I've been eperimenting with fieldFormat, eval, and tostring and, in this case, had no luck. I think part of the problem is that I don't know how to address the generated columns. They're not fields, they're values extracted by fields. If I try applying formatting to "Server_1" and so on (not an ideal solution) it doesn't work.&lt;/P&gt;

&lt;P&gt;Is there a way to apply numeric formatting to an extracted/calculated series like this?&lt;/P&gt;

&lt;P&gt;Thanks for any suggestions or pointers.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:14:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40367#M9294</guid>
      <dc:creator>dpadams</dc:creator>
      <dc:date>2020-09-28T10:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40368#M9295</link>
      <description>&lt;P&gt;The only way that I have found to do this is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="access*" | stats count by host uri_path | fieldformat count=tostring(count,"commas")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but you will lose the nice row vs. column formatting that the chart command gives you.  Of course, if you have more than a few hosts, you might like the stats output better for looking at the data points.  The chart command output will be easier to see as a graphic.&lt;/P&gt;

&lt;P&gt;Like you, I could not figure out how to address the generated columns in the chart command output.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 11:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40368#M9295</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-12-27T11:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40369#M9296</link>
      <description>&lt;P&gt;you can convert &lt;CODE&gt;stats&lt;/CODE&gt;-type output to &lt;CODE&gt;charts&lt;/CODE&gt;-type row/column headers with the &lt;CODE&gt;| xyseries&lt;/CODE&gt; search command, applied after the re-formatting.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 15:47:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40369#M9296</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-12-27T15:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40370#M9297</link>
      <description>&lt;P&gt;specifically, in this case: &lt;CODE&gt;... | xyseries host uri_path count&lt;/CODE&gt; to do it.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 15:49:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40370#M9297</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-12-27T15:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40371#M9298</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="access_common" | stats count by host uri_path | fieldformat count=tostring(count,"commas") | xyseries host uri_path count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or, if you're happy with the &lt;CODE&gt;stats&lt;/CODE&gt;-style row/column layout, you can drop the &lt;CODE&gt;xyseries&lt;/CODE&gt; command.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 15:51:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40371#M9298</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-12-27T15:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40372#M9299</link>
      <description>&lt;P&gt;I like the xyseries command, but if you run it, you will see that you get an extra column lablel "count" with no values.  What's up with that?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 20:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40372#M9299</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-12-27T20:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40373#M9300</link>
      <description>&lt;P&gt;Thanks for the answers and comments. I reversed the host and uri_path arguments to keep the URLs on the left. The output looks better, but I'm not quite there yet:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;There are still no commas.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;As Iguinn noted, there's now a spare column with no data labeled count.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;The zero values are now blank which is better than a blizzard of zeros. I'd like to try out putting in a dash as a placeholder. If that's not possible, I'll stick with the blanks.&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Thanks for any additional help and suggestions - it's very much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2011 22:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40373#M9300</guid>
      <dc:creator>dpadams</dc:creator>
      <dc:date>2011-12-27T22:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do you format numbers produced by 'count over'?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40374#M9301</link>
      <description>&lt;P&gt;I've just stubmled across ctable, which may even be better than xyseries:&lt;/P&gt;

&lt;P&gt;sourcetype="access_common"| ctable uri_path host | sort TOTAL DESC&lt;/P&gt;

&lt;P&gt;I end up with a table like I was getting from my original 'chart' search with the addition of a grand total column.&lt;/P&gt;

&lt;P&gt;Here again, I can't figure out what to pipe the results to or through to format the numbers in the series columns.  This pipe does format the grand dotal column:&lt;/P&gt;

&lt;P&gt;|  fieldFormat TOTAL=tostring(TOTAL,"commas") &lt;/P&gt;

&lt;P&gt;If I address a data column by the name Splunk gives it, the data is all set to empty.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:14:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-format-numbers-produced-by-count-over/m-p/40374#M9301</guid>
      <dc:creator>dpadams</dc:creator>
      <dc:date>2020-09-28T10:14:55Z</dc:date>
    </item>
  </channel>
</rss>

