<?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: HEC Posting Data Issue in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459014#M94296</link>
    <description>&lt;P&gt;Going to close this. I debugged all day and figured out that it is most likely some network settings on my Host PC. The code works from another PC.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 21:56:08 GMT</pubDate>
    <dc:creator>adam1124</dc:creator>
    <dc:date>2018-07-27T21:56:08Z</dc:date>
    <item>
      <title>HEC Posting Data Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459012#M94294</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am trying to post some data to splunk via QT's Network Module. Currently, I have the HEC setup to where it can receive cURL's: &lt;/P&gt;

&lt;P&gt;curl -k -H "Authorization: Splunk XXXXXXXXXXXXXXXXXXXXX" &lt;A href="https://splunkserver:8088/services/collector/event" target="_blank"&gt;https://splunkserver:8088/services/collector/event&lt;/A&gt; -d '{"sourcetype": "mysourcetype", "event": "http auth ftw!"}',&lt;/P&gt;

&lt;P&gt;but I get no reply for the server when trying this code (even though the traffic is confirmed via Wireshark to be making it to the Splunk server). The server is set up to receive jsonnotimestamp data. Here is the function being called with the same input url as the above cURL command:&lt;/P&gt;

&lt;P&gt;void Net::ConnectToSplunk(QString url)&lt;BR /&gt;
{&lt;BR /&gt;
  QUrl qrl(url);//QUrl has network adress&lt;BR /&gt;
  manager = new QNetworkAccessManager(this);//create manager&lt;BR /&gt;
  connect(manager, SIGNAL(finished(QNetworkReply*)),&lt;BR /&gt;
          this, SLOT(replyFinished(QNetworkReply*)));&lt;/P&gt;

&lt;P&gt;//Set up request url&lt;BR /&gt;
  QNetworkRequest request;&lt;BR /&gt;
  request.setUrl(url);&lt;BR /&gt;
  QString headerData = "Splunk XXXXXXXXXXXXXXXXXXXXXXXXXX";&lt;BR /&gt;
  request.setRawHeader("Authorization:", headerData.toLocal8Bit());&lt;/P&gt;

&lt;P&gt;//Set up payload&lt;BR /&gt;
  map.insert("event", "auth1234");&lt;BR /&gt;
  map.insert("sourcetype", "mysourcetype");&lt;BR /&gt;
  QByteArray payload=QJsonDocument::fromVariant(map).toJson();&lt;BR /&gt;
  qDebug() &amp;lt;&amp;lt; QVariant(payload).toString();&lt;BR /&gt;
  qDebug() &amp;lt;&amp;lt; request.rawHeaderList();&lt;/P&gt;

&lt;P&gt;QNetworkReply *reply = manager-&amp;gt;post(request,payload);&lt;BR /&gt;
  qDebug() &amp;lt;&amp;lt; reply-&amp;gt;readAll();&lt;BR /&gt;
  qDebug() &amp;lt;&amp;lt; "Headers:"&amp;lt;&amp;lt;  reply-&amp;gt;rawHeaderList()&amp;lt;&amp;lt; "content:" &amp;lt;&amp;lt; reply-&amp;gt;readAll();&lt;/P&gt;

&lt;P&gt;if ( reply-&amp;gt;error() != QNetworkReply::NoError ) {&lt;BR /&gt;
      qWarning() &amp;lt;&amp;lt;"ErrorNo: "&amp;lt;&amp;lt; reply-&amp;gt;error() &amp;lt;&amp;lt; "for url: " &amp;lt;&amp;lt; reply-&amp;gt;url().toString();&lt;BR /&gt;
      qDebug() &amp;lt;&amp;lt; "Request failed, " &amp;lt;&amp;lt; reply-&amp;gt;errorString();&lt;BR /&gt;
      qDebug() &amp;lt;&amp;lt; "Headers:"&amp;lt;&amp;lt;  reply-&amp;gt;rawHeaderList()&amp;lt;&amp;lt; "content:" &amp;lt;&amp;lt; reply-&amp;gt;readAll();&lt;BR /&gt;
  }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;I get the following debug output (No response at all from Splunk):&lt;BR /&gt;
"{\n    \"event\": \"auth1234\",\n    \"sourcetype\": \"mysourcetype\"\n}\n"&lt;BR /&gt;
("Authorization:")&lt;BR /&gt;
""&lt;BR /&gt;
Headers: () content: ""&lt;/P&gt;

&lt;P&gt;I even set up a json server on the same server as the Splunk server and it is receiving the post request just fine. Any ideas? &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:37:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459012#M94294</guid>
      <dc:creator>adam1124</dc:creator>
      <dc:date>2020-09-29T20:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: HEC Posting Data Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459013#M94295</link>
      <description>&lt;P&gt;disable ssl in global settings in HTTP Event Collector under data inputs.&lt;/P&gt;

&lt;P&gt;try with below request:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -H "Authorization: Splunk XXXXXXXXXXXXXXXXXXXXX" &lt;A href="http://splunkserver:8088/services/collector/event" target="test_blank"&gt;http://splunkserver:8088/services/collector/event&lt;/A&gt; -d '{"sourcetype": "mysourcetype", "event": "http auth ftw!"}',
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2018 18:33:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459013#M94295</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2018-07-27T18:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: HEC Posting Data Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459014#M94296</link>
      <description>&lt;P&gt;Going to close this. I debugged all day and figured out that it is most likely some network settings on my Host PC. The code works from another PC.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 21:56:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459014#M94296</guid>
      <dc:creator>adam1124</dc:creator>
      <dc:date>2018-07-27T21:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: HEC Posting Data Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459015#M94297</link>
      <description>&lt;P&gt;Hello, I had the same problems sending data from a Qt application to Splunk. &lt;/P&gt;

&lt;P&gt;First of all you have to replace:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;QString headerData = "Splunk XXXXXXXXXXXXXXXXXXXXXXXXXX";
request.setRawHeader("Authorization:", headerData.toLocal8Bit());
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;request.setRawHeader(QByteArray("Authorization"), QByteArray("Splunk XXXXXXXXXXXXXXXXXXXXXXXXXX"));
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Authorization without colon)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 10:01:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459015#M94297</guid>
      <dc:creator>andreas_franke_</dc:creator>
      <dc:date>2019-10-14T10:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: HEC Posting Data Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459016#M94298</link>
      <description>&lt;P&gt;Hello, I had the same problems sending data from a Qt application to Splunk. &lt;/P&gt;

&lt;P&gt;First of all you have to replace:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;QString headerData = "Splunk XXXXXXXXXXXXXXXXXXXXXXXXXX";
request.setRawHeader("Authorization:", headerData.toLocal8Bit());
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;request.setRawHeader(QByteArray("Authorization"), QByteArray("Splunk XXXXXXXXXXXXXXXXXXXXXXXXXX"));
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Authorization without colon)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 12:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/HEC-Posting-Data-Issue/m-p/459016#M94298</guid>
      <dc:creator>andreas_franke_</dc:creator>
      <dc:date>2019-10-14T12:25:03Z</dc:date>
    </item>
  </channel>
</rss>

