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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...