Splunk Search

Specific query from Splunk SH to create a Dashboard

splunk_luis12
Path Finder

Hi all, 

I'm trying to find the specific queries for the SH to create Splunk dashboard of the following info (example)

USER PID %MEM %CPU

root     40          5.6         0.4

root       12         4.2         0.2

I got the index named  "stats"  sourcetype "top"

I need that dashboard to show the info from just the last 5 minutes.

Any idea?

Thanks,

Max

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Can you provide some _raw events from your index in a code block </> so we can see what you are dealing with?

0 Karma

ashvinpandey
Contributor

@splunk_luis12 Try the below queries:

 

index=stats sourcetype=top
| rename "%MEM" as Memory "%CPU" as CPU "USER PID" as user
| stats avg(Memory) as Memory avg(CPU) as CPU by user

 

Show as timechart:

 

index=stats sourcetype=top
| rename "%MEM" as Memory "%CPU" as CPU "USER PID" as user
| timechart avg(Memory) as Memory avg(CPU) as CPU by user

 

Showing single value:

 

index=stats sourcetype=top
| rename "%MEM" as Memory "%CPU" as CPU "USER PID" as user
| stats avg(Memory) as Memory

 

 

 

 

index=stats sourcetype=top
| rename "%MEM" as Memory "%CPU" as CPU "USER PID" as user
| stats avg(CPU) as CPU

 

There are many more options to be explored.

Also if this reply helped you in solving your problem an up-vote would be appreciated 👍

0 Karma
Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...