Splunk AppDynamics

Custom time on E-mail alerts

Ilya_Nagornyy
Engager

Hello everyone
I faced a problem with variable on Email templates. When trigger text with ${action.triggerTime} sent to Email address, I see only UTC time, but for my notify's need to GMT+3. Im tried anything, but it not successed. 
Maybee someone knows how to use this variable with non-UTC time?

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

Morelz
Motivator

Hi Ilya

You can use the following, as AppD uses Apache Velocity, below is an example of GMT+2 where we use eventtime, but you can use it for any datetime in AppD. Please adjust the +2, to +3 for your use timezone and the Date Variable.

#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})

edited for formatting, C. Landivar, Community Manager & Editor 

View solution in original post

Morelz
Motivator

Hi Ilya

You can use the following, as AppD uses Apache Velocity, below is an example of GMT+2 where we use eventtime, but you can use it for any datetime in AppD. Please adjust the +2, to +3 for your use timezone and the Date Variable.

#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})

edited for formatting, C. Landivar, Community Manager & Editor 

Mohit_Gupta2
Explorer

Hi @Mario.Morelli,

Can you help me with +5:30 for IST time?

edited for formatting, C. Landivar, Community Manager & Editor 

0 Karma

Morelz
Motivator

Hi Mohit

Here you go:)

#set ($date = ${latestEvent.eventTime})

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

Ciao

edited for formatting, C. Landivar, Community Manager & Editor

Rohan_Banuri
New Member

Hi @Mario.Morelli ,

Can you help with EST? Time is showing eastern time but time zone is still showing UTC for me.

Thanks,

Rohan

0 Karma

Mohit_Gupta2
Explorer

Thanks Buddy!!

Worked for me.

Regards,

Mohit

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

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...