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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...