Splunk Search

Query using java jdk does not return any result if table command is used

osvaldo_pina
Loves-to-Learn Lots

I'm using java sdk to execute a search and if search has a table or stats count the query does not return any result. If I remove table command all results are returned

 Service service = Service.connect(loginArgs);

    StringBuilder searchQuery_blocking = new StringBuilder()
            .append("search earliest=-30d@d sourcetype=operacoes ");



    searchQuery_blocking
            .append("| eval id=md5(origem + destino + valor + tempo + status) ")
            .append(" |eval data_hora=strftime(_time, \"%d-%m-%Y %H:%M:%S\") ")
//         .append(" | table data_hora, id ")
    ;

    System.out.println(searchQuery_blocking);
    JobArgs jobargs = new JobArgs();
    jobargs.setExecutionMode(JobArgs.ExecutionMode.BLOCKING);

    Job job = service.getJobs().create(searchQuery_blocking.toString(), jobargs);

    InputStream is = job.getEvents();

    LineNumberReader lnr = new LineNumberReader(new InputStreamReader(is));

    String line =null;
    while((line = lnr.readLine()) != null) {
        System.out.println(line);
    }
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 ...