<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to return results in less than 1 second from Splunk java SDK? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-return-results-in-less-than-1-second-from-Splunk-java-SDK/m-p/585937#M10419</link>
    <description>&lt;P&gt;I am trying to get 10 events from Splunk. But it takes more than 40 minutes when UI returns results less than 1 sec&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;        String token = "token";
        String host = "splunk.mycompany.com";
        Map&amp;lt;String, Object&amp;gt; result = new HashMap&amp;lt;&amp;gt;();
        result.put("host", host);
        result.put("token", token);
        HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

        Service service = new Service(result);
        Job job = service.getJobs().create("search index=some_index earliest=-1h |head 10");
        while (!job.isReady()) {
            try {
                Thread.sleep(500); // 500 ms
            } catch (Exception e) {
                // Handle exception here.
            }
        }

        // Read results
        try {
            ResultsReader reader = new ResultsReaderXml(job.getEvents());

            // Iterate over events and print _raw field
            reader.forEach(event -&amp;gt; System.out.println(event.get("_raw")));

        } catch (Exception e) {
            // Handle exception here.
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What can be a cause of this? This code is from Splunk java sdk GitHub page. Token, host, etc. are changed from real to stub due to NDA&lt;/P&gt;</description>
    <pubDate>Tue, 22 Feb 2022 17:52:41 GMT</pubDate>
    <dc:creator>Anton_Pushkar_</dc:creator>
    <dc:date>2022-02-22T17:52:41Z</dc:date>
    <item>
      <title>How to return results in less than 1 second from Splunk java SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-return-results-in-less-than-1-second-from-Splunk-java-SDK/m-p/585937#M10419</link>
      <description>&lt;P&gt;I am trying to get 10 events from Splunk. But it takes more than 40 minutes when UI returns results less than 1 sec&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;        String token = "token";
        String host = "splunk.mycompany.com";
        Map&amp;lt;String, Object&amp;gt; result = new HashMap&amp;lt;&amp;gt;();
        result.put("host", host);
        result.put("token", token);
        HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

        Service service = new Service(result);
        Job job = service.getJobs().create("search index=some_index earliest=-1h |head 10");
        while (!job.isReady()) {
            try {
                Thread.sleep(500); // 500 ms
            } catch (Exception e) {
                // Handle exception here.
            }
        }

        // Read results
        try {
            ResultsReader reader = new ResultsReaderXml(job.getEvents());

            // Iterate over events and print _raw field
            reader.forEach(event -&amp;gt; System.out.println(event.get("_raw")));

        } catch (Exception e) {
            // Handle exception here.
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What can be a cause of this? This code is from Splunk java sdk GitHub page. Token, host, etc. are changed from real to stub due to NDA&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 17:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-return-results-in-less-than-1-second-from-Splunk-java-SDK/m-p/585937#M10419</guid>
      <dc:creator>Anton_Pushkar_</dc:creator>
      <dc:date>2022-02-22T17:52:41Z</dc:date>
    </item>
  </channel>
</rss>

