<?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 Why am I unable to post logs using Java SDK? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-unable-to-post-logs-using-Java-SDK/m-p/235793#M96289</link>
    <description>&lt;P&gt;I have attached below my code snippet. I am using a free developer access machine. &lt;A href="https://prd-p-lgqtg5v8fkdb.cloud.splunk.com"&gt;https://prd-p-lgqtg5v8fkdb.cloud.splunk.com&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;I am unable to login using my credentials. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;public class Splunk {
    public static void main(String args[]) throws IOException {
        HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

        Map&amp;lt;String, Object&amp;gt; connectionArgs = new HashMap&amp;lt;String, Object&amp;gt;();
        connectionArgs.put("host", "input-prd-p-lgqtg5v8fkdb.cloud.splunk.com");
        connectionArgs.put("username", "test123");
        connectionArgs.put("password", "test123");
        connectionArgs.put("port", 8089);
        connectionArgs.put("scheme", "https");

        Service splunkService = Service.connect(connectionArgs); 
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tried using a lot of ways. The curl works fine.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2016 17:56:19 GMT</pubDate>
    <dc:creator>srinitest123</dc:creator>
    <dc:date>2016-10-06T17:56:19Z</dc:date>
    <item>
      <title>Why am I unable to post logs using Java SDK?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-unable-to-post-logs-using-Java-SDK/m-p/235793#M96289</link>
      <description>&lt;P&gt;I have attached below my code snippet. I am using a free developer access machine. &lt;A href="https://prd-p-lgqtg5v8fkdb.cloud.splunk.com"&gt;https://prd-p-lgqtg5v8fkdb.cloud.splunk.com&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;I am unable to login using my credentials. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;public class Splunk {
    public static void main(String args[]) throws IOException {
        HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

        Map&amp;lt;String, Object&amp;gt; connectionArgs = new HashMap&amp;lt;String, Object&amp;gt;();
        connectionArgs.put("host", "input-prd-p-lgqtg5v8fkdb.cloud.splunk.com");
        connectionArgs.put("username", "test123");
        connectionArgs.put("password", "test123");
        connectionArgs.put("port", 8089);
        connectionArgs.put("scheme", "https");

        Service splunkService = Service.connect(connectionArgs); 
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tried using a lot of ways. The curl works fine.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 17:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-unable-to-post-logs-using-Java-SDK/m-p/235793#M96289</guid>
      <dc:creator>srinitest123</dc:creator>
      <dc:date>2016-10-06T17:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to post logs using Java SDK?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-unable-to-post-logs-using-Java-SDK/m-p/235794#M96290</link>
      <description>&lt;P&gt;I've successfully used the HTTP event collector ( &lt;A href="http://dev.splunk.com/view/event-collector/SP-CAAAE6M"&gt;http://dev.splunk.com/view/event-collector/SP-CAAAE6M&lt;/A&gt; ) mechanism to send data to the cloud. It works using a token rather than username/password (also different port). As the HTTP event collector (HEC) is based on REST you can create a java client (with your preferred HTTP java library) that passes data to Splunk Cloud.&lt;/P&gt;

&lt;P&gt;Example curl -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -X POST -d @**FILENAME** -H "Content-Type: application/json" -k &lt;A href="https://input-**SERVER**.cloud.splunk.com:8088/services/collector/event" target="test_blank"&gt;https://input-**SERVER**.cloud.splunk.com:8088/services/collector/event&lt;/A&gt; -H "Authorization: Splunk **HEC_TOKEN**"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Oct 2016 22:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-unable-to-post-logs-using-Java-SDK/m-p/235794#M96290</guid>
      <dc:creator>msivill_splunk</dc:creator>
      <dc:date>2016-10-06T22:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to post logs using Java SDK?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-unable-to-post-logs-using-Java-SDK/m-p/235795#M96291</link>
      <description>&lt;P&gt;Hi @srinitest123 - I saw that you up voted msivill's answer. If it helped answer your question, please don't forget to resolve this post by clicking "Accept" below the answer. Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2016 00:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-unable-to-post-logs-using-Java-SDK/m-p/235795#M96291</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-10-08T00:37:45Z</dc:date>
    </item>
  </channel>
</rss>

