Splunk Search

## How to create a scatter chart over time and duration, with a line for max duration?

New Member

Hello Guys,

I have a requirement where I need to create a scatter chart of tickets. I need to have a ticket created time on the x-axis, duration in the y-axis (duration=now()-ticketcreatedtime).

whenever a ticket reaches it max duration, ticket should disappear. For that, we need to have a line for max duration.

Tags (5) SplunkTrust

It occurs to me that your requirement is .... a less than useful selection for a visualization.

All the points on the "scatterplot" are always going to be along a straight line. (In practice it may "jig" a little, but in reality it's mathematically straight.) If your max duration is (for example) 20 days, then the far left point possible is 19 days ago, and the left edge and top edge of the chart both represent a ticket aged 20 days. Basically, duration and start date/time are the same measurement, so a graph that compares them is a waste of electrons.

Here's a run-anywhere code to generate random test data and show you a graph, assuming that your max duration was 20 days.

``````| makeresults count=100 | eval timeago=(random()% 1000) | eval timeago=1.6*timeago*timeago+ (random()% 10000)| eval _time = _time-timeago | bin _time  span=6h | table _time | eval duration=round((now()-_time)/86400,2) | timechart avg(duration) span=12h
``````
New Member

Hello,

Thanks for your answer. Assume that is a 24 hrly chart, with x-axis showing last 24 hrs with span=1hr and max duration as 8hrs, then what would be the search query?  