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 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...