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!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...