datetime() submacro

Prev Next

Alert webhook macros like alertProcessingTimestampUTC and alertCreateDateLocal returns the date and time in a concatenated format like 20170412105408131. This may not not be easy/friendly to read.

In order to format the date and time in a more readable way, we can make use of datetime() sub-macro.

For example:

{ 
"alertProcessingTimestampUTC": "${alertProcessingTimestampUTC}",
"alertCreateDateLocal": "${alertCreateDateLocal}",
}

This JSON template without the datetime macro gives the output as shown below.

Now, if we use the datetime macro like the example given below, we get the date and time in a more readable format.

{ 
"alertProcessingTimestampUTC": "${alertProcessingTimestampUTC(datetime(yyyy-MM-ddHH:mm:ss))}", 
"AlertCreateDateLocal": "${AlertCreateDateLocal(datetime(yyyy-MM-dd HH:mm:ss))}"  
}