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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...