Splunk AppDynamics

Manipulate datetime in Alert Template

Morelz
Motivator

Hi there

Does anyone have a way to manipulate the time in an alert template. It'showing the event time in UTC time, not in the customer's time

We have SaaS Controllers which are in Europe however the customer is in a different timezone, however from AppD Support it seems we cannot update the time in the Alert.

This obviously causes confusion when the customer sees the event time is out by a couple of hours 

Surely there is a way to add/subtract hours in the template itself?

Any help is appreciated:)

Labels (3)
Tags (2)
0 Karma
1 Solution

Morelz
Motivator

For anybody else looking for this, please find working code below, we are GMT+2

You can change the code to fit your needs

#set ($date = ${latestEvent.eventTime})
#set ($newDate = ${date.getHours()}+(2))
$date.setHours(${newDate})
#set( $String = ' ' ) $String.format('%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tSZ', ${date})

View solution in original post

Morelz
Motivator

For anybody else looking for this, please find working code below, we are GMT+2

You can change the code to fit your needs

#set ($date = ${latestEvent.eventTime})
#set ($newDate = ${date.getHours()}+(2))
$date.setHours(${newDate})
#set( $String = ' ' ) $String.format('%1$tY-%1$tm-%1$tdT%1$tH:%1$tM:%1$tSZ', ${date})

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...