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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...