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.
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:
Reference: Conversion and casting functions — Dynatrace Docs
Regards,
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)

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,