Splunk Search

I am trying to implement time limit on the query, but failing to fetch the result

priyabhakat
New Member

public static void executeQuery(String query,String earliestTime,String latestTime)
{

    Args queryArgs=new Args();
    queryArgs.put("earliest_time", earliestTime);
    queryArgs.put("latest_time", latestTime);
    splunkJob= splunkService.getJobs().create(query,queryArgs); 

    while(!splunkJob.isDone()){
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
0 Karma

lguinn2
Legend

The variables (earliestTime and latestTime) that you used in queryArgs.put must contain a date-time string similar to this
"2012-06-20T12:00:00.000-07:00"

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Refer to code examples from this link. Check the format of values and classes to be used.
http://dev.splunk.com/view/java-sdk/SP-CAAAEHQ

0 Karma

aaraneta_splunk
Splunk Employee
Splunk Employee

@priyabhakat - Your question is quite vague. Please leave a comment with more information. In general, your question has a greater chance of being answered by experts in the Answers community when when you provide as much information and context as possible. Thanks.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...