Splunk Search

Getting commas into a multivalue number field

sjbriggs
Path Finder

I'm posting this in case someone else has the problem I struggled with.

I had was calculating a list of upload and download totals per webdomain per company location into a list.  The format of the table was such that I ended up with the company location, followed by a multivalued list of the web domains, and a multivalued list of the bytes totals. 

The bytes totals being 7 to 8 digit numbers are easier to read with commas but the usual formatting solution:

eval Download=tostring(Download, "commas")
eval Upload=tostring(Upload, "commas")

Had mixed results depending on where in the query I placed it.  After the initial transformation command, it messed up my sorting since now it was a string.  At the end, it summed the multi-value field and then put the commas in so that didn't help.

 

Labels (4)
1 Solution

sjbriggs
Path Finder

Finally, I found that mvmap was my solution since I could apply the 'tostring' function on each item after the the final transformation command at the end of my query.  No issues with sorting or format of my table at that point.

eval Download=mvmap(Download,tostring(Download, "commas"))
eval Upload=mvmap(Upload,tostring(Upload, "commas"))

View solution in original post

sjbriggs
Path Finder

Finally, I found that mvmap was my solution since I could apply the 'tostring' function on each item after the the final transformation command at the end of my query.  No issues with sorting or format of my table at that point.

eval Download=mvmap(Download,tostring(Download, "commas"))
eval Upload=mvmap(Upload,tostring(Upload, "commas"))

richgalloway
SplunkTrust
SplunkTrust

Great post, @sjbriggs!  Would you mind editing this into a question-and-answer format and then accept the answer?  That would make it clearer to future readers that this is a solution rather than an unsolved question.

---
If this reply helps you, Karma would be appreciated.
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 ...