Getting Data In

REST API - error "Invalid earliest_time."

jetzt82
Explorer

Use Splunk SDK JAVA, I'd use the REST API.
If the settings as follows causes an error.

code:

Args queryArgs = new Args();
queryArgs.put("earliest_time",  "8/21/2014:00:00:00");
queryArgs.put("latest_time",    "8/31/2014:23:59:59");

error:

[Fatal Error] :1:1: Unexpected end of file.
Exception in thread "main" com.splunk.HttpException: HTTP 400 -- <?xml version="1.0" encoding="UTF-8"?>
<response>
  <messages>
    <msg type="FATAL">Invalid earliest_time.</msg>
  </messages>
</response>

at com.splunk.HttpException.create(HttpException.java:84)
at com.splunk.HttpService.send(HttpService.java:386)
at com.splunk.Service.send(Service.java:1268)
at com.splunk.HttpService.post(HttpService.java:243)
at com.splunk.JobCollection.create(JobCollection.java:81)
at Test01_02.Test01_02_01.main(Test01_02_01.java:59)

Are there any workaround for this?

Tags (3)
0 Karma

sklass
Path Finder

In poking through the returned data - when it did work it looks like the format should be.

YYYY-MM-DDTHH:MM:SS

Example: 2015-05-02T07:30:00

You can also append your timezone at the end as well. Really this is way harder than it should be.

richgalloway
SplunkTrust
SplunkTrust

The format of the time strings don't look right. Have you tried "8/31/2014T00:00:00"?

---
If this reply helps you, Karma would be appreciated.
0 Karma

jetzt82
Explorer

queryArgs.put("earliest_time", "8/21/2014T00:00:00");
queryArgs.put("latest_time", "8/31/2014T23:59:59");

The same error occurs.

0 Karma

swaprks
Observer

Did you manage to get a solution for this? For me as well this fails. But the relative thing works. Like -1d and so but this does not

MM/dd/yyyy':'HH:mm:ss
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...