Dashboards & Visualizations

How do I generate a histogram from a comma separated list of numbers?

Magrilloc
New Member

I have events formatted like this:

09/19/16 07:07:00 | Name=ABC123 Host=MyHost123.com
ProcessHistogram2: 0,0,0,0,0,0,0,1,0,34,66,66,64,68,60,79,7374,13812,0,0,0,0,0,0,0,0,0,0

I am trying to generate an aggregate (min,average and max) histogram chart over time where each comma separated value is a bucket.

I have some control over the data format, so I can rearrange the event formatting if it makes the search easier.

Doing it in excel would result in something like this:

alt text

0 Karma
1 Solution

sundareshr
Legend

Try this

Name=123 Host=ABC | rex "ProcessHistogram2\:\s(?<ph>[^\s]+)" | eval times="0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900" | makemv ph delim="," | makemv times delim="," | eval z=mvzip(times, ph) | mvexpand z | rex field=z "(?<t>[^\,]+)\,(?<ph>.*)" | table _time t ph | chart values(ph) as ph over t by _time

http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Chart

View solution in original post

0 Karma

sundareshr
Legend

Try this

Name=123 Host=ABC | rex "ProcessHistogram2\:\s(?<ph>[^\s]+)" | eval times="0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900" | makemv ph delim="," | makemv times delim="," | eval z=mvzip(times, ph) | mvexpand z | rex field=z "(?<t>[^\,]+)\,(?<ph>.*)" | table _time t ph | chart values(ph) as ph over t by _time

http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Chart

0 Karma

Magrilloc
New Member

When I try this I get an table with only time stamps in it and no data in the ph column. I removed the chart command as it was returning no data for me to inspect.

0 Karma

sundareshr
Legend

Try this search "as-is". This is a run-anywhere sample. See if this gives you the desired results

| makeresults | eval ph="0,0,0,0,0,0,0,1,0,34,66,66,64,68,60,79,7374,13812,0,0,0,0,0,0,0,0,0,0" | eval times="0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900" | makemv ph delim="," | makemv times delim="," | eval z=mvzip(times, ph) | mvexpand z | rex field=z "(?<t>[^\,]+)\,(?<ph>.*)" | table _time t ph | chart values(ph) as ph over t by _time
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

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 ...