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 | 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 ...