<?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: curl in Shell Script run by splunk return empty in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340065#M62730</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you please try below command in your script, added ().&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;IP=($(curl -s 'http://api.openweathermap.org/data/2.5/weather?q=london,uk≈pid=xxxxxxxxxxxxxxxxxxxxxxx'))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Harshil&lt;/P&gt;</description>
    <pubDate>Sun, 05 Mar 2017 14:48:40 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2017-03-05T14:48:40Z</dc:date>
    <item>
      <title>curl in Shell Script run by splunk return empty</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340064#M62729</link>
      <description>&lt;P&gt;I am trying to get data from a third party API&lt;/P&gt;

&lt;P&gt;so I get splunk to run this very basic script.&lt;/P&gt;

&lt;P&gt;IP=$(curl -s '&lt;A href="http://api.openweathermap.org/data/2.5/weather?q=london,uk&amp;amp;appid=xxxxxxxxxxxxxxxxxxxxxxx'"&gt;http://api.openweathermap.org/data/2.5/weather?q=london,uk&amp;amp;appid=xxxxxxxxxxxxxxxxxxxxxxx'&lt;/A&gt;)&lt;BR /&gt;
echo "$IP"&lt;/P&gt;

&lt;P&gt;if I run the script in shell it works perfect.&lt;BR /&gt;
if it is run by splunk $ip is empty&lt;/P&gt;

&lt;P&gt;I know splunk can execute the script because I replace $(curl.... by "test" and splunk collects it OK.&lt;/P&gt;

&lt;P&gt;splunk seams to be executing script as root because if chance my script to &lt;BR /&gt;
whoiam&lt;BR /&gt;
splunk returns root.&lt;/P&gt;

&lt;P&gt;it is not just this url i tried different ones, it works in shell but it is always empty when run by splunk.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 10:54:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340064#M62729</guid>
      <dc:creator>pdevosceazure</dc:creator>
      <dc:date>2017-03-05T10:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: curl in Shell Script run by splunk return empty</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340065#M62730</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you please try below command in your script, added ().&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;IP=($(curl -s 'http://api.openweathermap.org/data/2.5/weather?q=london,uk≈pid=xxxxxxxxxxxxxxxxxxxxxxx'))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Harshil&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 14:48:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340065#M62730</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-03-05T14:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: curl in Shell Script run by splunk return empty</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340066#M62731</link>
      <description>&lt;P&gt;The best way to integrate with API is to use "&lt;A href="https://splunkbase.splunk.com/app/1546/"&gt;REST modular Input&lt;/A&gt;" within splunk rather than calling a script etc.&lt;/P&gt;

&lt;P&gt;There are some &lt;A href="https://www.splunk.com/blog/2013/06/18/getting-data-from-your-rest-apis-into-splunk/"&gt;good docs out there&lt;/A&gt;, thus making your "splunk" application itself to handle API requests&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 15:59:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340066#M62731</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2017-03-05T15:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: curl in Shell Script run by splunk return empty</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340067#M62732</link>
      <description>&lt;P&gt;I had seen this but could not find in in splunk any where in 6.5.&lt;BR /&gt;
did not realise is as an add on. will try it out.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 10:09:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/curl-in-Shell-Script-run-by-splunk-return-empty/m-p/340067#M62732</guid>
      <dc:creator>pdevosceazure</dc:creator>
      <dc:date>2017-03-06T10:09:55Z</dc:date>
    </item>
  </channel>
</rss>

