Splunk Search

serach string combination

Splunk_U
Path Finder

I want to create a sreach string that will provide the avegCPU util, PeakCPU util, AvgMem util and PeakMem util.
I have created four different search string. How to combine them?

average memory usage
index=os sourcetype=vmstat | multikv fields memUsedPct | stats avg(memUsedPct) by host

peak memory usage
index=os sourcetype=vmstat | multikv fields memUsedPct | stats max(memUsedPct) by host

average CPU usage
index=os sourcetype=cpu | multikv fields pctIdle | search all | eval Percent_CPU_Load = 100 - pctIdle | stats avg(Percent_CPU_Load) as Average by host

Peak CPU usage
index=os sourcetype=cpu | multikv fields pctIdle | search all | eval Percent_CPU_Load = 100 - pctIdle | stats max(Percent_CPU_Load) as Peak by host

HELP me out!!!!

Tags (2)
0 Karma
1 Solution

lguinn2
Legend

This should do it:

index=os sourcetype=vmstat 
| multikv fields memUsedPct  
| stats avg(memUsedPct) max(memUsedPct) by host
| join host [ search index=os sourcetype=cpu 
    | multikv fields pctIdle  
    | search all  
    | eval Percent_CPU_Load = 100 - pctIdle  
    | stats avg(Percent_CPU_Load) as Average max(Percent_CPU_Load) as Peak  by host ]

View solution in original post

lguinn2
Legend

This should do it:

index=os sourcetype=vmstat 
| multikv fields memUsedPct  
| stats avg(memUsedPct) max(memUsedPct) by host
| join host [ search index=os sourcetype=cpu 
    | multikv fields pctIdle  
    | search all  
    | eval Percent_CPU_Load = 100 - pctIdle  
    | stats avg(Percent_CPU_Load) as Average max(Percent_CPU_Load) as Peak  by host ]
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...