Splunk Search

current hour

LauraBre
Communicator

Hello,

I want to have the hour of the current time but I don't able to have it because now() returns all the current date but just want to have the current hour.

this is my search :

source="tcp:5543" |eval date_hour=strftime(_time, "%H") | rangemap field=count severe=0-0 elevated=1-50 default=low | eval range=if(date_hour>9 AND date_hour<14 AND count<11, "low",if(date_hour > 13 AND date_hour < 24 AND count > 11, "severe", range))

I want to run this search only on the current hour. I test it with "earliest" and "latest" but it retunrs 2 hours if it is 14:30 for example.

Thanks by advance to your help.

Laura

Tags (1)
0 Karma

lpolo
Motivator

Try this:

earliest=@h latest=now

Lp

LauraBre
Communicator

It's perfect thx very much.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...