Splunk Dev

Add-on builder: how to convert unix timestamp into UTC for a checkpoint and how to use Date.now()

TKelly
Explorer

So I'm trying to setup REST API calls with Add-on Builder and it requires two params: 'fromDate' and 'toDate'. So I ran into 2 problems:

1)  'toDate' in my case is time/date now (at the moment of API call). Is it possible to set up this param to something like Date.now() in JavaScript? 

2) 'fromDate' should be a checkpoint taken from the last record in the last response. The problem is that in the response this timestamp is in UNIX format. And for request, it should be UTC %d/%m/%y%H%M. How can I convert UNIX into UTC? + can I add an additional second to this extracted timestamp so my data won't overlap? 

Labels (3)
0 Karma
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

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, ...