Splunk Search

How to to update hour of a timestamp variable?

mxh7777
Path Finder

Hi,

I'm looking for a way to change the hour of a time variable

Exemple :

myTime="2022-11-20 05:23:42"

and I want myTime to be equal "2022-11-20 08:00:00"

How can I proceed please ?


Thanks

Labels (2)
0 Karma

mxh7777
Path Finder

OK,

I think i get it.

This works

| eval myTime=strptime(strftime(strptime(myTime,"%Y-%m-%d %H:%M:%S") ,"%Y-%m-%d 08:%M:%S") ,"%Y-%m-%d %H:%M:%S")

but maybe there is a better way

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...