Splunk Search

Search Query Help!

kc_prane
Communicator

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!

Why You Can't Miss .conf25: Unleashing the Power of Agentic AI with Splunk & Cisco

The Defining Technology Movement of Our Lifetime The advent of agentic AI is arguably the defining technology ...

Deep Dive into Federated Analytics: Unlocking the Full Power of Your Security Data

In today’s complex digital landscape, security teams face increasing pressure to protect sprawling data across ...

Your summer travels continue with new course releases

Summer in the Northern hemisphere is in full swing, and is often a time to travel and explore. If your summer ...