Splunk Search

Search Query Help!

kc_prane
Path Finder

Hello, I am looking for my search results for only 6pm to 9pm over the last 90 days. How can I achieve this with the below query?

index=* host=*  | eval pctCPU=if(CPU="all",100-pctIdle,Value) | timechart  avg(pctCPU) AS avgCPU BY host
Labels (1)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try filtering the results on the date_hour field.

index=* host=*  
| where date_hour>=18 AND date_hour<21
| eval pctCPU=if(CPU="all",100-pctIdle,Value) 
| timechart  avg(pctCPU) AS avgCPU BY host
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...