cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need assistance with converting timestamp from the format (2024030602500000) (yyyymmddhhmmssSS) to 2024-03-06T02:50:00Z

karthik_r
Visitor

Hello Team,

Can anyone please assist with conversion of the following timestamp in dynatrace log processing rules?

To convert timestamp from the format (2024030602500000) (yyyymmddhhmmssSS) to 2024-03-06T02:50:00Z (local timezone of the oneAgent server)

Thanks.

3 REPLIES 3

cesarsaravia
Dynatrace Pro
Dynatrace Pro

Hi @karthik_r 
You can use the Timestamp/Splitting patterns to make what you want.

If you already upgraded to Log management and analytics (GRAIL), You can use the DQL to convert the data type of your timestamp. See this example:

cesarsaravia_0-1709680929151.png

Reference: https://docs.dynatrace.com/docs/shortlink/conversion-and-casting-functions#toTimestamp 

Regards, 

-César S. - LATAM Solutions Architect

karthik_r
Visitor

Thanks @cesarsaravia for your response.

The timestamp value (2024030602500000) what I am trying to convert is not the Unix Epoch time, and when I try to convert the value, it gives me the following, which is not correct.

Query: data record(timestamp = 2024030602500000)
                | fieldsAdd type(timestamp), toTimestamp(timestamp)

 

Output: toTimestamp(timestamp)

              1970-01-24 15:43:50.602

Please let me know if I am doing anything wrong.

Hi @karthik_r 
In that case you need to use the function timestamp.

 

data record(timestamp = 2024030602500000)
| fieldsAdd new_time= timestamp(year:2024, month:3, day:6, hour:2, minute:50, second:00)

 

cesarsaravia_0-1709738525986.png

Ps: I think you should use a parse function to extract those values for year, month, day, hour, minute and second from your custom timestamp value.

Reference: 

Regards,

-César S. - LATAM Solutions Architect

Featured Posts