Splunk Search

Build a chart of multiple data series

guilmxm
Influencer

Hi to everyone,

I am designing an application where my users will potentially need to be able to generate a chart with multiple data series. (depending on their own selection and various options available)

I searched in different posts and i followed this doc with success:
http://docs.splunk.com/Documentation/Splunk/latest/Search/Chartmultipledataseries

This works good, but still i have a small issue with the chart being created in the dashboard, the time period is technically correct but not being shown as would generates the timechart command. (each date section is being shown so too much data with more than a few hours)

A correct chart generated with timechart:
alt text

A chart generating with the stat command with multiple series:
alt text

My command is the following:

index="rls_index" sourcetype="rls_source" $hostname$ $monitor$ $monitor_label$
bucket _time span=1h | stats max(value) As ValMax, min(value) As ValMin by _time,monitor_label |
eval s1="max min" | makemv s1 | mvexpand s1 | eval yval=case(s1=="max",ValMax,s1=="min",ValMin) | eval series=monitor_label+":"+s1 | convert ctime(_time) as time | xyseries time,series,yval

I needed to add the section "convert ctime(_time) as time" to get a shorter and more readable time format.

Does anyone knows how to generate a chart with the time period being correctly shown like with timechart ?

I had to use the bucket command to limit the amount of data generated, i also would like to put a timerange condition like the timechart command automatically does ? (something like if more than 1 day then bucket 1 hour and so on)

Thank you in advance for any help you could provide.

Long live to Splunk ^^

Tags (3)

jonuwz
Influencer

Use _time in xyseries and add ... | makecontinuous _time to the end. You don't need to convert _time beforehand.

The charting stuff makes the x-axis labels 'pretty' if it contains regularly intervaled epoch values

jonuwz
Influencer

Thanks Guilhem. Accepting the answer is the usual way to award rep (you dont have to spend your own)

0 Karma

guilmxm
Influencer

Hi,

Thank you very much, you perfectly answered to my question!

Guilhem

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...