<?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: HTTP Event Collector: Is there a working example with cURL on Windows? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217872#M42866</link>
    <description>&lt;P&gt;Glad you like it and thanks for sharing!&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2016 16:47:48 GMT</pubDate>
    <dc:creator>gblock_splunk</dc:creator>
    <dc:date>2016-02-24T16:47:48Z</dc:date>
    <item>
      <title>HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217871#M42865</link>
      <description>&lt;P&gt;I've started experimenting with the HTTP event collector recently, and I like what I have seen so far.&lt;BR /&gt;
There are a few great articles online describing the HTTP architecture with simple examples of using cURL to POST data to an HTTP event collector. However, there are nuances using cURL on Windows and posting multiple values in an event, which are best explained via working code.&lt;/P&gt;

&lt;P&gt;The following example posts two events:  "Breakfast Order" (simple event) and an event with three breakfast items (more complex event) to a Splunk indexer via the HTTP collector.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k &lt;A href="https://10.19.16.101:8088/services/collector/event" target="test_blank"&gt;https://10.19.16.101:8088/services/collector/event&lt;/A&gt; -H "Authorization: Splunk 982D05B0-8603-4311-A1AF-32462BA47C9F" -d "{\"event\":\"Breakfast Order\"} {\"event\":{\"coffee\":\"double cream double sugar\",\"muffin\":\"blueberry\",\"juice\":\"none\"}}"
{"text":"Success","code":0}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Windows errors when you use the single quotes &lt;CODE&gt;'&lt;/CODE&gt; so, change them to double quotes &lt;CODE&gt;"&lt;/CODE&gt; and escape the other double quotes &lt;CODE&gt;\"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1082i4B1839835059D885/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks goes to:&lt;BR /&gt;
Glenn Block for this article &lt;A href="http://blogs.splunk.com/2015/10/06/http-event-collector-your-direct-event-pipe-to-splunk-6-3/"&gt;http://blogs.splunk.com/2015/10/06/http-event-collector-your-direct-event-pipe-to-splunk-6-3/&lt;/A&gt;&lt;BR /&gt;
And whomever wrote this article: &lt;A href="http://dev.splunk.com/view/event-collector/SP-CAAAE7F"&gt;http://dev.splunk.com/view/event-collector/SP-CAAAE7F&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 15:46:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217871#M42865</guid>
      <dc:creator>fdarrigo</dc:creator>
      <dc:date>2016-02-24T15:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217872#M42866</link>
      <description>&lt;P&gt;Glad you like it and thanks for sharing!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 16:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217872#M42866</guid>
      <dc:creator>gblock_splunk</dc:creator>
      <dc:date>2016-02-24T16:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217873#M42867</link>
      <description>&lt;P&gt;Thanks for sharing @fdarrigo &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Would you actually be able to post your formal answer in the "Enter your answer here..." box below and Accept it? Otherwise, this helpful post will float in limbo as unresolved on Answers. Thanks, and I'll upvote the answer once it's posted. Cheers!&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 00:40:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217873#M42867</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2016-02-25T00:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217874#M42868</link>
      <description>&lt;P&gt;For a more complete understanding of the http-event-collector, check out the links I referenced above.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 14:14:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217874#M42868</guid>
      <dc:creator>fdarrigo</dc:creator>
      <dc:date>2016-02-25T14:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217875#M42869</link>
      <description>&lt;P&gt;This post may interest you also as a potential alternative to Curl on Windows.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/373010/powershell-sample-for-http-event-collector.html"&gt;https://answers.splunk.com/answers/373010/powershell-sample-for-http-event-collector.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2016 10:55:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217875#M42869</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2016-02-28T10:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217876#M42870</link>
      <description>&lt;P&gt;I use cURL on Windows for ad hoc EC ingestion. To avoid escaping quotes, I save my JSON to a file, and refer to that file in the curl &lt;CODE&gt;-d&lt;/CODE&gt; option by prefixing the path with an at sign (@). For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-d @ec_input.json
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For details, see the &lt;A href="https://curl.haxx.se/docs/manpage.html#-d"&gt;curl man page&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;I also use a variety of homegrown PowerShell scripts (.ps1), batch files (.bat) - some of which are simply wrappers for curl - and Java programs to send JSON to EC. For example, I use Java to massage JSON lines-formatted event data with an ISO 8601-formatted time stamp field into EC "packets" with a Unix Epoch &lt;CODE&gt;time&lt;/CODE&gt; metadata field.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 03:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217876#M42870</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2016-05-06T03:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217877#M42871</link>
      <description>&lt;P&gt;Hi @fdarrigo,&lt;/P&gt;

&lt;P&gt;I was able to send test events using the below command few days back. &lt;/P&gt;

&lt;P&gt;irm -Method Post -Uri "&lt;A href="https://URL.com/services/collector/event"&gt;https://URL.com/services/collector/event&lt;/A&gt;" -Headers @{Authorization = "Splunk "} -Body '{"event": "test1 "}'&lt;/P&gt;

&lt;P&gt;But when I tried sending a test event today it gave me an error.&lt;/P&gt;

&lt;P&gt;irm : The underlying connection was closed: An unexpected error occurred on a send.&lt;BR /&gt;
At line:1 char:1&lt;BR /&gt;
+ irm -Method Post -Uri "&lt;A href="https://URL.com/"&gt;https://URL.com/&lt;/A&gt; ...&lt;BR /&gt;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebE&lt;BR /&gt;
   eption&lt;BR /&gt;
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand&lt;/P&gt;

&lt;P&gt;Any idea what could be causing this?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 10:22:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217877#M42871</guid>
      <dc:creator>Arpit_S</dc:creator>
      <dc:date>2019-08-30T10:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP Event Collector: Is there a working example with cURL on Windows?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217878#M42872</link>
      <description>&lt;P&gt;This question is a few year old, but here's the latest answer in case someone else needs it...&lt;/P&gt;

&lt;P&gt;If your Windows 10 build is 17063 or later, you have curl.exe built into Windows. Source: &lt;A href="https://techcommunity.microsoft.com/t5/Containers/Tar-and-Curl-Come-to-Windows/ba-p/382409"&gt;https://techcommunity.microsoft.com/t5/Containers/Tar-and-Curl-Come-to-Windows/ba-p/382409&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;How to check your build? Press the Windows key and the r key at the same time, sometimes noted as WIN+R, to open the Run dialog box. Type winver in the run box and press enter.&lt;/P&gt;

&lt;P&gt;How to use curl on Windows? Call curl.exe and use parameters Just like curl on Linux or Mac. So your line #1 becomes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl.exe -k &lt;A href="https://10.19.16.101:8088/services/collector/event" target="test_blank"&gt;https://10.19.16.101:8088/services/collector/event&lt;/A&gt; -H "Authorization: Splunk 982D05B0-8603-4311-A1AF-32462BA47C9F" -d "{\"event\":\"Breakfast Order\"} {\"event\":{\"coffee\":\"double cream double sugar\",\"muffin\":\"blueberry\",\"juice\":\"none\"}}"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 20:04:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HTTP-Event-Collector-Is-there-a-working-example-with-cURL-on/m-p/217878#M42872</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2019-10-10T20:04:14Z</dc:date>
    </item>
  </channel>
</rss>

