Splunk Search

Format results with comma thousands separator

Oren
Explorer

How do I format the output to have comma separators - I want 1,234,567, not 1234567. Any easy way?

Given a query like:

eventtype=request | sistats sum(http_bytes) as bytes by http_domain | sort -bytes | head 100

I'd like bytes to be more human readable.

0 Karma
1 Solution

Stephen_Sorkin
Splunk Employee
Splunk Employee

You can use the tostring(X, "commas") function in eval (http://www.splunk.com/base/Documentation/latest/SearchReference/CommonEvalFunctions):

eventtype=request | stats sum(http_bytes) as bytes by http_domain | sort -bytes | eval bytes = tostring(bytes, "commas") | head 100

View solution in original post

juanxiayan
Explorer

If you said that, I can't draw chart(or graph).

Stephen_Sorkin
Splunk Employee
Splunk Employee

You can use the tostring(X, "commas") function in eval (http://www.splunk.com/base/Documentation/latest/SearchReference/CommonEvalFunctions):

eventtype=request | stats sum(http_bytes) as bytes by http_domain | sort -bytes | eval bytes = tostring(bytes, "commas") | head 100
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...