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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...