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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...