<?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: Why does index creation via Java SDK returns null value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/591126#M205801</link>
    <description>&lt;P&gt;EntityCollection&amp;lt;Index&amp;gt; indexes = splunkService.getIndexes();&lt;/P&gt;&lt;P&gt;splunkService.getIndexes();&lt;/P&gt;&lt;P&gt;the above line giving error ,pasted in below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tgandham1_1-1648489784740.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18795i7D045F0230DEBA5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tgandham1_1-1648489784740.png" alt="tgandham1_1-1648489784740.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;due this Create index returning null pointer error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Mar 2022 17:50:39 GMT</pubDate>
    <dc:creator>tgandham1</dc:creator>
    <dc:date>2022-03-28T17:50:39Z</dc:date>
    <item>
      <title>Why does index creation via Java SDK returns null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372288#M109513</link>
      <description>&lt;P&gt;Hi colleagues,&lt;BR /&gt;
I am trying to create index using the Java SDK for Splunk and to reset the &lt;STRONG&gt;"FrozenTimePeriodInSecs"&lt;/STRONG&gt; property afterwards.&lt;BR /&gt;
The code snippet follows: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ServiceArgs loginArgs = new ServiceArgs();
        loginArgs.setUsername("admin");
        loginArgs.setPassword("admin");
        loginArgs.setHost("host");
        loginArgs.setPort(8089);

String indexName = "testIndex_" + System.currentTimeMillis(); 

HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);        
Service splunkService = Service.connect(login);
IndexCollection indexCollection = splunkService.getIndexes();
Index createdIndex = indexCollection.create(indexName);
createdIndex.setFrozenTimePeriodInSecs(retentionPeriod);
createdIndex.update();
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I run into &lt;STRONG&gt;java.lang.NullPointerException&lt;/STRONG&gt; because apparently the the &lt;STRONG&gt;IndexCollection.create(String indexName);&lt;/STRONG&gt;  returns a null value.&lt;BR /&gt;
Any idea what am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 14:44:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372288#M109513</guid>
      <dc:creator>Silviya_brayano</dc:creator>
      <dc:date>2018-03-22T14:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why does index creation via Java SDK returns null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372289#M109514</link>
      <description>&lt;P&gt;On line  10 I actually pass the loginArgs and not login.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 15:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372289#M109514</guid>
      <dc:creator>Silviya_brayano</dc:creator>
      <dc:date>2018-03-22T15:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why does index creation via Java SDK returns null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372290#M109515</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have found the root cause.&lt;BR /&gt;
The problem is with the capital &lt;STRONG&gt;"I"&lt;/STRONG&gt; in the &lt;STRONG&gt;testIndex_&amp;lt;timestamp&amp;gt;&lt;/STRONG&gt;.&lt;BR /&gt;
It turns out that despite my attempt to create an index with name  &lt;STRONG&gt;testIndex_&amp;lt;timestamp&amp;gt;&lt;/STRONG&gt; (capital &lt;STRONG&gt;"I"&lt;/STRONG&gt;) on the backend an index with name &lt;STRONG&gt;testindex_&amp;lt;timestamp&amp;gt;&lt;/STRONG&gt; (lower case &lt;STRONG&gt;"i"&lt;/STRONG&gt;) is created. &lt;/P&gt;

&lt;P&gt;The method &lt;STRONG&gt;IndexCollection.create(String indexName)&lt;/STRONG&gt; sends internal GET request attempting to obtain the Index object, having the original name &lt;STRONG&gt;testIndex_&amp;lt;timestamp&amp;gt;&lt;/STRONG&gt; with (capital &lt;STRONG&gt;"I"&lt;/STRONG&gt;) and since on the back end there is no such thing that method returns null value.&lt;/P&gt;

&lt;P&gt;In my opinion that is a bug.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 16:52:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372290#M109515</guid>
      <dc:creator>Silviya_brayano</dc:creator>
      <dc:date>2018-03-22T16:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why does index creation via Java SDK returns null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372291#M109516</link>
      <description>&lt;P&gt;Index names are always lower case.  Per the Managing Indexers and Clusters of Indexers docs: "User-defined index names must consist of only numbers, lowercase letters, underscores, and hyphens."&lt;/P&gt;

&lt;P&gt;Splunk probably should block attempts to create an index with an invalid name or warn that it changed the name, but  I see no bug here.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 17:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/372291#M109516</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-03-22T17:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why does index creation via Java SDK returns null value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/591126#M205801</link>
      <description>&lt;P&gt;EntityCollection&amp;lt;Index&amp;gt; indexes = splunkService.getIndexes();&lt;/P&gt;&lt;P&gt;splunkService.getIndexes();&lt;/P&gt;&lt;P&gt;the above line giving error ,pasted in below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tgandham1_1-1648489784740.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18795i7D045F0230DEBA5E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tgandham1_1-1648489784740.png" alt="tgandham1_1-1648489784740.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;due this Create index returning null pointer error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 17:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-index-creation-via-Java-SDK-returns-null-value/m-p/591126#M205801</guid>
      <dc:creator>tgandham1</dc:creator>
      <dc:date>2022-03-28T17:50:39Z</dc:date>
    </item>
  </channel>
</rss>

