How to convert "execution_time" : "2017-10-27T07:09:14.666Z" of watcher to unix epoch time so that the converted epoch time can be used in the action.
can you create some context around your question? Where do you want to access this? Can you share your watch and examples? Thanks
Using webhook action in the Watcher module to send the alert to the external ticketing system, when greater than n number of errors are found in the logs. While doing so the external system requires certain parameters needs to be sent as part of RESTful HTTP Post request. One of them is the execution_time which needs to be in epoch time. So the watch payload execution_time date time field needs to be converted to unix epoch time.
I am also alternatively checking if the execution_time (as in the watcher response) can be sent as is to the external system. instead of converting it to unix epoch time.
you can call
ctx.execution_time.getMillis() in a painless transform script before your action and thus get the milliseconds since the epoch.
Great. Thank you. Will try this.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.