Splunk Search

Can we pull system time in 'If' Condition

amithhegde
New Member

I have an alert created where I need to display current system time. There is an If condition in alert which looks something like below.

eval checkstatus=if(isnull(status), "Program has not started at @Current System Time@", "OK")

@Current System Time@ is where i want to have my system time displayed.

Is there a way this can be achieved?

Tags (1)
0 Karma

Ayn
Legend

now() should be what you're looking for I think?

eval checkstatus=if(isnull(status), "Program has not started at " . now(), "OK")

This gives you the epoch value which might not be what you want, for something more humanly readable you could do

eval checkstatus=if(isnull(status), "Program has not started at " . strftime(now(),"%+"), "OK")
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You can do this:

eval checkstatus=if(isnull(status), "Program has not started at ".strftime(now(), "%F %T"), "OK")
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...