<?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: Is it possible to have several indixes associated with the same HEC and send logs to only one through POST? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501789#M85493</link>
    <description>&lt;P&gt;The index is paired with the token and you can create as many tokens as you like.  What are you trying to do?  Are you trying to send the same data to multiple indexERS?  Are you trying to send the same data to multiple indICES?  Are you trying to send data to an indEX not paired with your token (not possible)?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2019 15:13:10 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-12-05T15:13:10Z</dc:date>
    <item>
      <title>Is it possible to have several indixes associated with the same HEC and send logs to only one through POST?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501788#M85492</link>
      <description>&lt;P&gt;Hello, I am using Splunk Cloud and I need to have several indixes "AAAA", "BBBB", "CCCC", "DDDD" associated to the same HEC, I am trying to insert logs to a specific index indicating the index through POST, but the logs They are always inserted into the Default Index.&lt;BR /&gt;
Is it possible to use the same HEC for several indixes and specify only one when you are going to insert the logs by POST?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 12:43:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501788#M85492</guid>
      <dc:creator>flck</dc:creator>
      <dc:date>2019-12-05T12:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have several indixes associated with the same HEC and send logs to only one through POST?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501789#M85493</link>
      <description>&lt;P&gt;The index is paired with the token and you can create as many tokens as you like.  What are you trying to do?  Are you trying to send the same data to multiple indexERS?  Are you trying to send the same data to multiple indICES?  Are you trying to send data to an indEX not paired with your token (not possible)?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 15:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501789#M85493</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-05T15:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have several indixes associated with the same HEC and send logs to only one through POST?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501790#M85494</link>
      <description>&lt;P&gt;Hello everyone, thanks for your replies.&lt;BR /&gt;
I was able to solve it, finally I created a new HEC in the HTTP Event Collector and associated to it all my 4 indixes to this new HEC, then using python, my main connection function is this:&lt;/P&gt;

&lt;P&gt;import json&lt;BR /&gt;
import requests&lt;/P&gt;

&lt;P&gt;class PyHEC:&lt;BR /&gt;
    def &lt;STRONG&gt;init&lt;/STRONG&gt;(self, token, uri):&lt;BR /&gt;
        if not 'http' in uri:&lt;BR /&gt;
            raise("no http or https found in hostname")&lt;BR /&gt;
        self.token = token&lt;BR /&gt;
        self.uri = uri+"/services/collector/event"&lt;BR /&gt;
    def send(self, event, metadata=None):&lt;BR /&gt;
        headers = {'Authorization': 'Splunk '+self.token}&lt;BR /&gt;
        payload = {"host": self.uri,&lt;BR /&gt;
                   "event": event}&lt;BR /&gt;
        if metadata:&lt;BR /&gt;
            payload.update(metadata)&lt;BR /&gt;
        r = requests.post(self.uri, data=json.dumps(payload), headers=headers, verify=True if 'https' in self.uri else False)&lt;BR /&gt;
        return r.status_code, r.text,&lt;/P&gt;

&lt;P&gt;The class call is made every time you need to make an input to a different index.&lt;/P&gt;

&lt;P&gt;hec = PyHEC('HEC_PASSWORD', "URL")&lt;BR /&gt;
try:&lt;BR /&gt;
    data = open('FILE1.json','r')&lt;BR /&gt;
    event = (data.read())&lt;BR /&gt;
    metadata = {"index":"INDEX_AAAA", "host":"HOST_INPUT"}&lt;BR /&gt;
    print hec.send(event, metadata)&lt;BR /&gt;
except Exception as e:&lt;BR /&gt;
    print('Error')&lt;BR /&gt;
try:&lt;BR /&gt;
    data = open('FILE2.json','r')&lt;BR /&gt;
    event = (data.read())&lt;BR /&gt;
    metadata = {"index":"INDEX_BBBB", "host":"HOST_INPUT"}&lt;BR /&gt;
    print hec.send(event, metadata)&lt;BR /&gt;
except Exception as e:&lt;BR /&gt;
    print('Error')&lt;/P&gt;

&lt;P&gt;I will consider the answer solved. Regards.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501790#M85494</guid>
      <dc:creator>flck</dc:creator>
      <dc:date>2020-09-30T03:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have several indixes associated with the same HEC and send logs to only one through POST?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501791#M85495</link>
      <description>&lt;P&gt;I also thought of another way besides &lt;CODE&gt;CLONE_SOURCETYPE&lt;/CODE&gt; (which doesn't at all do what you need it to).  You should be able to use &lt;CODE&gt;INGEST_EVAL = index = YourIndexHere&lt;/CODE&gt; to override anything, provided you can find an appropriate &lt;CODE&gt;stanza header&lt;/CODE&gt; to associate this setting only to your &lt;CODE&gt;HEC&lt;/CODE&gt; stuff, probably &lt;CODE&gt;[source::...]&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 17:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-have-several-indixes-associated-with-the-same/m-p/501791#M85495</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-06T17:38:56Z</dc:date>
    </item>
  </channel>
</rss>

