Splunk Search

How to plot values (without using max(), avg(), count()...)

Explorer

Hello.

I would like to create a line chart but, I don't want to plot a max() or an avg()?

I just want to show the numbers that CPU_IDLE_USAGE (in this case) returns. For example:

_time              CPU_ID CPU_IDLE_USAGE 
8/23/10 11:25:00.000 PM 0 90 
8/23/10 11:20:00.000 PM 0 83 
8/23/10 11:15:00.000 PM 0 81 
8/23/10 11:10:00.000 PM 0 82 
8/23/10 11:05:00.000 PM 0 88 
8/23/10 11:00:00.000 PM 0 78 

I would like to plot the following values: 90, 83, 81, 82, 88... etc. How can I do that?

So far I'm using something like:

source=*slu* CPU_ID=0| timechart max(CPU_IDLE_USAGE)

I already tried:

source=*slu* CPU_ID=0| timechart CPU_IDLE_USAGE

but Splunks says the use of a function is mandatory.

What can I do?

Thanks.

Thank you again

Tags (1)
1 Solution

Splunk Employee
Splunk Employee

Please see: http://answers.splunk.com/questions/5991/simple-question-i-think-charting-field-values-over-time

You can use the first() function:

 source=*slu* CPU_ID=0| timechart first(CPU_IDLE_USAGE) as CPU_IDLE_USAGE

The use of a function is mandatory because timechart must know how to resolve potential multiple values in an interval. If you are certain there are none, then the result is identical.

One of the purposes of stats/chart/timechart is to aggregate varying amounts of data over varying intervals. If you have no need to do this, you can also use table:

 source=*slu* CPU_ID=0| table _time CPU_IDLE_USAGE

View solution in original post

New Member

I'd recommend doing something like this:

source=slu CPUID=0| table _time CPUIDLE_USAGE

This creates a table with actual values in it. By adding a _time column, you can then click over to the Visualizations tab and it will know how to chart it. Note that this won't work for a large number of data points.

0 Karma

Splunk Employee
Splunk Employee

Please see: http://answers.splunk.com/questions/5991/simple-question-i-think-charting-field-values-over-time

You can use the first() function:

 source=*slu* CPU_ID=0| timechart first(CPU_IDLE_USAGE) as CPU_IDLE_USAGE

The use of a function is mandatory because timechart must know how to resolve potential multiple values in an interval. If you are certain there are none, then the result is identical.

One of the purposes of stats/chart/timechart is to aggregate varying amounts of data over varying intervals. If you have no need to do this, you can also use table:

 source=*slu* CPU_ID=0| table _time CPU_IDLE_USAGE

View solution in original post

Explorer

Thank you very much!

0 Karma