<?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 Re: How to make search using Splunk Rest API in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305577#M57656</link>
    <description>&lt;P&gt;Well in that case you can use the Splunk Java SDK from Groovy.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://gist.github.com/damiendallimore/3263074"&gt;Here is an old Gist of mine&lt;/A&gt; that shows how to use the Java SDK from Groovy.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/java-sdk/SP-CAAAEHQ"&gt;And here are examples&lt;/A&gt; of using the Java SDK to execute Searches.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2017 19:16:02 GMT</pubDate>
    <dc:creator>Damien_Dallimor</dc:creator>
    <dc:date>2017-10-12T19:16:02Z</dc:date>
    <item>
      <title>How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305574#M57653</link>
      <description>&lt;P&gt;I have following search query that I run on the Splunk search UI &amp;amp; It works fine:&lt;/P&gt;

&lt;P&gt;index=cpaws source=PFT buildNumber=14 type=REQUEST | stats p98(wholeduration) as currentRunP98Duration| appendcols [search index=cpaws source=PFT buildNumber=13 type=REQUEST |  stats p98(wholeduration) as previousRunP98Duration1] | appendcols [search index=cpaws source=PFT buildNumber=12 type=REQUEST |  stats p98(wholeduration) as previousRunP98Duration2] |eval avgP98=(previousRunP98Duration1+previousRunP98Duration2)/2 | eval success=if(currentRunP98Duration&amp;gt;=avgP98*0.1,"Good","BAD")| table success&lt;/P&gt;

&lt;P&gt;For printing out parameter "success", I was using the table command. Now I want to call the same query using the Splunk REST API and in return I want to get the success parameter value. How can I do that?&lt;/P&gt;

&lt;P&gt;I went through the Splunk REST API Documentation but I couldn't/didn't find anything helpful. Please help me.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 18:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305574#M57653</guid>
      <dc:creator>neeldesai1992</dc:creator>
      <dc:date>2017-10-12T18:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305575#M57654</link>
      <description>&lt;P&gt;You have not described how you are attempting to use the REST API.&lt;/P&gt;

&lt;P&gt;So I will just make this suggestion, try using one of the SDKs , such as the Python SDK.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEE5"&gt;There are plenty of examples&lt;/A&gt; of how to execute a search&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 18:55:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305575#M57654</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2017-10-12T18:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305576#M57655</link>
      <description>&lt;P&gt;Sorry not by SDK. So Actually I want to write a groovy script which will be part of my post build action of jenkins job. Which will make request to splunk and will get the data and extract it. I am not sure which endPoint can help me out for this.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 18:59:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305576#M57655</guid>
      <dc:creator>neeldesai1992</dc:creator>
      <dc:date>2017-10-12T18:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305577#M57656</link>
      <description>&lt;P&gt;Well in that case you can use the Splunk Java SDK from Groovy.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://gist.github.com/damiendallimore/3263074"&gt;Here is an old Gist of mine&lt;/A&gt; that shows how to use the Java SDK from Groovy.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/java-sdk/SP-CAAAEHQ"&gt;And here are examples&lt;/A&gt; of using the Java SDK to execute Searches.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 19:16:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305577#M57656</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2017-10-12T19:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305578#M57657</link>
      <description>&lt;P&gt;To see any example do I need to connect splunk Enterprise Instance?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 19:27:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305578#M57657</guid>
      <dc:creator>neeldesai1992</dc:creator>
      <dc:date>2017-10-12T19:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305579#M57658</link>
      <description>&lt;P&gt;To &lt;STRONG&gt;see&lt;/STRONG&gt; the example you click on the link I posted.&lt;/P&gt;

&lt;P&gt;To &lt;STRONG&gt;try out&lt;/STRONG&gt; the example , then obviously you need to connect to a Splunk Enterprise instance.Very simple to setup on your own local machine , &lt;A href="https://www.splunk.com/en_us/download.html"&gt;https://www.splunk.com/en_us/download.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 19:58:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305579#M57658</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2017-10-12T19:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305580#M57659</link>
      <description>&lt;P&gt;But I think this will not help me. I have search query ready. I just want to make Splunk server call and execute this search query and get the result&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305580#M57659</guid>
      <dc:creator>neeldesai1992</dc:creator>
      <dc:date>2017-10-12T20:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305581#M57660</link>
      <description>&lt;P&gt;What ,  reading the docs/examples provided  won't help you ? &lt;/P&gt;

&lt;P&gt;I've given you examples to follow , I suggest reading the docs and actually trying them. Have you attempted to try anything yet ?&lt;/P&gt;

&lt;P&gt;The docs/examples I've linked to &lt;STRONG&gt;are very clear&lt;/STRONG&gt; on how to the execute a Splunk search query via the REST API and get the result.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:10:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305581#M57660</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2017-10-12T20:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305582#M57661</link>
      <description>&lt;P&gt;yeah let me try that out you are right.sorry and thanks&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:21:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305582#M57661</guid>
      <dc:creator>neeldesai1992</dc:creator>
      <dc:date>2017-10-12T20:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305583#M57662</link>
      <description>&lt;P&gt;I put down the following program: &lt;BR /&gt;
import com.splunk.*;&lt;BR /&gt;
public class ConnectToSplunk {&lt;BR /&gt;
    public static void main(String[] args) {&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    // Create a map of arguments and add login parameters
    ServiceArgs loginArgs = new ServiceArgs();
    loginArgs.setUsername("admin");
    loginArgs.setPassword("changeme");
    loginArgs.setHost("localhost");
    loginArgs.setPort(8000);

    // Create a Service instance and log in with the argument map
    Service service = Service.connect(loginArgs);


    // A second way to create a new Service object and log in
    // Service service = new Service("localhost", 8089);
    // service.login("admin", "changeme");

    // A third way to create a new Service object and log in
    // Service service = new Service(loginArgs);
    // service.login();

    // Print installed apps to the console to verify login
    for (Application app : service.getApplications().values()) {
        System.out.println(app.getName());
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;This gives me the following error&lt;BR /&gt;
Exception in thread "main" java.lang.RuntimeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)&lt;BR /&gt;
    at com.splunk.HttpService.send(HttpService.java:409)&lt;BR /&gt;
    at com.splunk.Service.send(Service.java:1293)&lt;BR /&gt;
    at com.splunk.HttpService.post(HttpService.java:308)&lt;BR /&gt;
    at com.splunk.Service.login(Service.java:1122)&lt;BR /&gt;
    at com.splunk.Service.login(Service.java:1101)&lt;BR /&gt;
    at com.splunk.Service.connect(Service.java:187)&lt;BR /&gt;
    at ConnectToSplunk.main(ConnectToSplunk.java:13)&lt;BR /&gt;
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)&lt;BR /&gt;
    at sun.security.ssl.Handshaker.activate(Handshaker.java:503)&lt;BR /&gt;
    at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1482)&lt;BR /&gt;
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1351)&lt;BR /&gt;
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)&lt;BR /&gt;
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)&lt;BR /&gt;
    at sun.net.&lt;A href="http://www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)"&gt;www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)&lt;/A&gt;&lt;BR /&gt;
    at sun.net.&lt;A href="http://www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)"&gt;www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)&lt;/A&gt;&lt;BR /&gt;
    at sun.net.&lt;A href="http://www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283)"&gt;www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283)&lt;/A&gt;&lt;BR /&gt;
    at sun.net.&lt;A href="http://www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258)"&gt;www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258)&lt;/A&gt;&lt;BR /&gt;
    at sun.net.&lt;A href="http://www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)"&gt;www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)&lt;/A&gt;&lt;BR /&gt;
    at com.splunk.HttpService.send(HttpService.java:403)&lt;BR /&gt;
    ... 6 more&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 02:12:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305583#M57662</guid>
      <dc:creator>neeldesai1992</dc:creator>
      <dc:date>2017-10-13T02:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to make search using Splunk Rest API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305584#M57663</link>
      <description>&lt;P&gt;Use &lt;A href="https://:/services/search/jobs/export" target="test_blank"&gt;https://:/services/search/jobs/export&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 20:19:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-make-search-using-Splunk-Rest-API/m-p/305584#M57663</guid>
      <dc:creator>neeldesai1992</dc:creator>
      <dc:date>2017-10-13T20:19:49Z</dc:date>
    </item>
  </channel>
</rss>

