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!

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...

Splunkbase | Splunk Dashboard Examples App for SimpleXML End of Life

The Splunk Dashboard Examples App for SimpleXML will reach end of support on Dec 19, 2024, after which no new ...

Understanding Generative AI Techniques and Their Application in Cybersecurity

Watch On-Demand Artificial intelligence is the talk of the town nowadays, with industries of all kinds ...