Splunk Search

Need help on timechart with value

jackin
Path Finder

Hi,

Here's my query -

| mstats max(_value) avg(_value) min(_value) prestats=true WHERE metric_name="cpu.system" AND"index"="osnixperf" AND 
[| inputlookup Unix.csv] BY host span=1h
| stats Avg(_value) AS Avg1 BY host
| join
[| mstats max(_value) avg(_value) min(_value) prestats=true WHERE metric_name="cpu.user" AND"index"="osnixperf" AND
[| inputlookup Unix.csv] BY host span=1h
| stats Avg(_value) AS Avg2 BY host]
| eval totalavg=Avg1+Avg2,totalavg=round(totalavg,2)

I need the timechart that shows with totalavg value like below image. 

jackin_0-1635926340469.png

 

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your stats commands are removing the time element from your results - try something like this

| mstats max(_value) avg(_value) AS Avg1 min(_value) prestats=true WHERE metric_name="cpu.system" AND"index"="osnixperf" AND 
[| inputlookup Unix.csv] BY host span=1h 
| join 
[| mstats max(_value) avg(_value) AS Avg2 min(_value) prestats=true WHERE metric_name="cpu.user" AND"index"="osnixperf" AND 
[| inputlookup Unix.csv] BY host span=1h 
| eval totalavg=Avg1+Avg2,totalavg=round(totalavg,2)
0 Karma

jackin
Path Finder

@ITWhisperer Hi,

Its looks as working but but it not showing any values and error msg's
can you give me any suggestions to my query OR can you help any different way to calculate the  2 metrics.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

OK start with the first mstats - does this give you what you expect from just that index?

Then try the second mstats separately - does this give you what you expect from just that index?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...