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!

What's New in Splunk Observability - October 2025

What’s New?  We’re excited to announce the latest enhancements to Splunk Observability Cloud and share what’s ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened Audit Trail v2 wasn’t written in isolation—it was shaped by your voices. In ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

 Prepare to elevate your security operations with the powerful upgrade to Splunk Enterprise Security 8.x! This ...