Splunk Search

Need Help with query

omprakash9998
Path Finder

Trying build a time chart for Top 10 CPU consuming Processes for a Linux host for a given timeframe.

 

 

index=os host=xxxxxx source=top pctCPU != 0.0 
| table COMMAND, pctCPU _time | sort - pctCPU | dedup COMMAND | head 10

 

 

 

I am trying to get a timechart based for the pctCPU  usage only for these 10 COMMANDS. 

 

Thanks

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

You could try something like this

index=os host=xxxxxx source=top pctCPU != 0.0 
| fields COMMAND, pctCPU _time 
| eventstats max(pctCPU) as maxpctCPU by COMMAND
| sort - maxpctCPU COMMAND
| streamstats dc(COMMAND) as rank
| where rank <= 10
| fields - rank maxpctCPU
| timechart span=1h max(pctCPU) as maxpctCPU by COMMAND

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could try something like this

index=os host=xxxxxx source=top pctCPU != 0.0 
| fields COMMAND, pctCPU _time 
| eventstats max(pctCPU) as maxpctCPU by COMMAND
| sort - maxpctCPU COMMAND
| streamstats dc(COMMAND) as rank
| where rank <= 10
| fields - rank maxpctCPU
| timechart span=1h max(pctCPU) as maxpctCPU by COMMAND
0 Karma
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...