<?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 Is it possible to run a curl command on a dbxquery? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500081#M85221</link>
    <description>&lt;P&gt;I am working with Splunk's rest API.  I have to make a post request to Splunk and get some data from a dbxquery.  I tried using the following curl command but got an error stating dbxquery is an unknown search command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -H "Authorization: Basic cHp2NjBzcGx1bms6U3BsdW5rMTIz" -k &lt;A href="https://se138628.devmaple.devfg.rbc.com:8089/services/search/jobs" target="test_blank"&gt;https://se138628.devmaple.devfg.rbc.com:8089/services/search/jobs&lt;/A&gt; -d search="| dbxquery query%22select%20count(distinct%20id)..." -d output_mode=json -d id=test_search_2 -d adhoc_search_level=fast -d earliest_time=-2h -d max_count=10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was wondering if it is possible to make a curl command with dbx searches and return the json data.&lt;/P&gt;

&lt;P&gt;Regards.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2019 19:19:41 GMT</pubDate>
    <dc:creator>ssharm02</dc:creator>
    <dc:date>2019-10-09T19:19:41Z</dc:date>
    <item>
      <title>Is it possible to run a curl command on a dbxquery?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500081#M85221</link>
      <description>&lt;P&gt;I am working with Splunk's rest API.  I have to make a post request to Splunk and get some data from a dbxquery.  I tried using the following curl command but got an error stating dbxquery is an unknown search command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -H "Authorization: Basic cHp2NjBzcGx1bms6U3BsdW5rMTIz" -k &lt;A href="https://se138628.devmaple.devfg.rbc.com:8089/services/search/jobs" target="test_blank"&gt;https://se138628.devmaple.devfg.rbc.com:8089/services/search/jobs&lt;/A&gt; -d search="| dbxquery query%22select%20count(distinct%20id)..." -d output_mode=json -d id=test_search_2 -d adhoc_search_level=fast -d earliest_time=-2h -d max_count=10
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was wondering if it is possible to make a curl command with dbx searches and return the json data.&lt;/P&gt;

&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2019 19:19:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500081#M85221</guid>
      <dc:creator>ssharm02</dc:creator>
      <dc:date>2019-10-09T19:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run a curl command on a dbxquery?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500082#M85222</link>
      <description>&lt;P&gt;Hi ssharm01, &lt;/P&gt;

&lt;P&gt;You could use &lt;CODE&gt;CURL&lt;/CODE&gt; to run &lt;CODE&gt;DBX&lt;/CODE&gt; Query. &lt;BR /&gt;
&lt;STRONG&gt;Note : Make sure the User (in the authentication token) have access to run the dbx query.&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;Here are the information about the end point. &lt;STRONG&gt;services/search/jobs&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;GET&lt;/CODE&gt; :Get details of all current searches. &lt;BR /&gt;
&lt;CODE&gt;POST&lt;/CODE&gt;: Start a new search and return the search ID ( &lt;CODE&gt;&amp;lt;sid&amp;gt;&lt;/CODE&gt;) &lt;/P&gt;

&lt;P&gt;Above CURL call will create a job and return the Job ID (SID). using the job id, you should make another call to &lt;CODE&gt;search/jobs/{search_id}/results&lt;/CODE&gt; to get results. &lt;/P&gt;

&lt;P&gt;REST Call 1: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -H 'Authorization: Basic auth token' -k &lt;A href="https://localhost:8089/services/search/jobs" target="test_blank"&gt;https://localhost:8089/services/search/jobs&lt;/A&gt;  -d search=" | dbxquery query=\"SELECT count(*) FROM db.table\" connection=\"connection\"" -d output_mode=json 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Rest Call 2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -H 'Authorization: Basic auth token' -k 'https://localhost:8089/services/search/jobs/`&amp;lt;SID&amp;gt;`/results' --get -d output_mode=json 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Read this docs for more info:  &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/RESTREF/RESTsearch"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/RESTREF/RESTsearch&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps you&lt;/P&gt;

&lt;P&gt;Cheers!!!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2019 21:06:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500082#M85222</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2019-10-09T21:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run a curl command on a dbxquery?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500083#M85223</link>
      <description>&lt;P&gt;Hey Vasanthmss, I tried what you suggested and I am still getting the same error.  Type Fatal, Unknown search command 'dbxquery.'&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 12:44:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500083#M85223</guid>
      <dc:creator>ssharm02</dc:creator>
      <dc:date>2019-10-10T12:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run a curl command on a dbxquery?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500084#M85224</link>
      <description>&lt;P&gt;Are you able to run the search in web ui with the same user ?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 20:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500084#M85224</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2019-10-15T20:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run a curl command on a dbxquery?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500085#M85225</link>
      <description>&lt;P&gt;Hi Vasanthmss,&lt;/P&gt;

&lt;P&gt;This error doesn't seem to be related to user privileges, since the cmd console is saying the dbxquery is an unknown search command.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 19:46:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500085#M85225</guid>
      <dc:creator>ssharm02</dc:creator>
      <dc:date>2019-10-16T19:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run a curl command on a dbxquery?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500086#M85226</link>
      <description>&lt;P&gt;Your suggestion worked for me.  I did have to add two escape backslashes on the SQL queries though (node.js environment)&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 16:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/500086#M85226</guid>
      <dc:creator>ssharm02</dc:creator>
      <dc:date>2019-10-25T16:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to run a curl command on a dbxquery?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/547370#M91111</link>
      <description>&lt;P&gt;I believe commands that start with a pipe in the UI have an implied&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search | ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in front of the command. Try changing your search parameter from:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search=" | dbxquery query=\"SELECT count(*) FROM db.table\"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search="search | dbxquery query=\"SELECT count(*) FROM db.table\"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 14:00:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-run-a-curl-command-on-a-dbxquery/m-p/547370#M91111</guid>
      <dc:creator>tmuth_splunk</dc:creator>
      <dc:date>2021-04-09T14:00:48Z</dc:date>
    </item>
  </channel>
</rss>

