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!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...