<?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: Dynamically update index based on client hostname in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429447#M20899</link>
    <description>&lt;P&gt;Can you provide some more details on how the index depends on the client hostname? Is there some logic / structure to that?&lt;/P&gt;

&lt;P&gt;One way would be to define a TRANSFORMS that overrides the index based on hostname. Another could be to create different flavors of the app, with different indexes configured and assign each to the right set of clients based on their hostname using serverclasses. And perhaps there are more options. But it would help to better understand the logic behind the hostname to index mapping to help you figure out what the best solution would be.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2019 18:29:04 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2019-06-19T18:29:04Z</dc:date>
    <item>
      <title>Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429446#M20898</link>
      <description>&lt;P&gt;We have on premise deployment of splunk enterprise and are using deployment server to deploy apps to UF's (or clients). We need a way to dynamically update index based on client hostname when deployment server deploys the app or update the index of the app after it is deployed to the UF. Basically, index has to be based on the client hostname. &lt;/P&gt;

&lt;P&gt;Not sure if there is a way to achieve this or not, any help for this would be greatly appreciated. Thanks in advance!!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 17:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429446#M20898</guid>
      <dc:creator>boomiagarg</dc:creator>
      <dc:date>2019-06-19T17:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429447#M20899</link>
      <description>&lt;P&gt;Can you provide some more details on how the index depends on the client hostname? Is there some logic / structure to that?&lt;/P&gt;

&lt;P&gt;One way would be to define a TRANSFORMS that overrides the index based on hostname. Another could be to create different flavors of the app, with different indexes configured and assign each to the right set of clients based on their hostname using serverclasses. And perhaps there are more options. But it would help to better understand the logic behind the hostname to index mapping to help you figure out what the best solution would be.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:29:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429447#M20899</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-19T18:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429448#M20900</link>
      <description>&lt;P&gt;So my usecase is - &lt;/P&gt;

&lt;P&gt;clientname format - &lt;BR /&gt;
client1-acct1&lt;BR /&gt;
client2-acct2&lt;/P&gt;

&lt;P&gt;client1-acct1 inputs.conf  sends data to both indexes&lt;BR /&gt;
index=index1&lt;BR /&gt;
index=index2&lt;/P&gt;

&lt;P&gt;client2-acct2 inputs.conf sends data to both indexes-&lt;BR /&gt;
index=index1&lt;BR /&gt;
index=index2&lt;/P&gt;

&lt;P&gt;Indexes available on indexers-&lt;BR /&gt;
index1-acct1&lt;BR /&gt;
Index1-acct2&lt;BR /&gt;
index2-acct1&lt;BR /&gt;
Index2-acct2&lt;/P&gt;

&lt;P&gt;Now I want to use props and transforms to each event logged and update the indexes to -&lt;BR /&gt;
for client1-acct1 event with index1&lt;BR /&gt;
index=index1-acct1&lt;BR /&gt;
index=index2-acct1&lt;/P&gt;

&lt;P&gt;for client2-acct2 event with index1&lt;BR /&gt;
index=index1-acct2&lt;BR /&gt;
index=index2-acct2&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 20:58:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429448#M20900</guid>
      <dc:creator>boomiagarg</dc:creator>
      <dc:date>2019-06-19T20:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429449#M20901</link>
      <description>&lt;P&gt;I agree with @FrankVl here.  You would most likely either utilize the server classes on your deployment server to separate out the inputs based on the client hostnames like this:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Have a serverclass for client1-acct1 to only send to index1-acct1 and index2-acct1 and so on and so forth. Server classes can be set with client filters using wildcard filters as well so your clients can be filtered like this:  *-acct1 would get the apps with inputs for the acct1 indexes. Then you would do the same for the acct2 hosts and indexes.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The other option would be to use a TRANSFORMS for an override based on the hostname, but in all honestly, if you can use the deployment server and server classes, I would recommend that.&lt;/P&gt;

&lt;P&gt;For more information on server classes:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.0/Updating/Useserverclass.conf"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.0/Updating/Useserverclass.conf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 03:47:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429449#M20901</guid>
      <dc:creator>ragedsparrow</dc:creator>
      <dc:date>2019-06-20T03:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429450#M20902</link>
      <description>&lt;P&gt;See @ragedsparrow his comment on how to do it through server classes on the DS. If that would not work due to the number of different &lt;CODE&gt;acct*&lt;/CODE&gt; options and indexes, then you could use a TRANSFORMS as well. Which in this case, with the variable part of the index being literally part of the hostname, can be done quite elegantly:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
TRANSFORMS-setindex = set_index_by_host_acct
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[set_index_by_host_acct]
SOURCE_KEY = MetaData:Host
REGEX = -(acct\d+)$
DEST_KEY = _MetaData:Index
FORMAT = $0-$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This keeps the current index setting, and appends &lt;CODE&gt;-&lt;/CODE&gt; followed by the &lt;CODE&gt;acct*&lt;/CODE&gt; string captured from the hostname.&lt;/P&gt;

&lt;P&gt;Note: you are mentioning sending data to 2 indexes. I don't think you can do that by simply specifying 2 &lt;CODE&gt;index=...&lt;/CODE&gt; settings in inputs.conf. Splunk will only use one of those. If you want to clone data into 2 indexes you probably need to take a look at using &lt;CODE&gt;CLONE_SOURCETYPE&lt;/CODE&gt; in transforms.conf. But without full understanding of why you want to do that it is hard to go into details on that part (might be a good one to cover in a separate question if you need help with that).&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 07:24:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429450#M20902</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-20T07:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429451#M20903</link>
      <description>&lt;P&gt;hi @ragedsparrow ,&lt;BR /&gt;
Since you are recommending using serverclasses instead of transform.  Wondering if there is a benefit for one over the another Or if there are any downsides to use props and transforms.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 16:17:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429451#M20903</guid>
      <dc:creator>boomiagarg</dc:creator>
      <dc:date>2019-06-20T16:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429452#M20904</link>
      <description>&lt;P&gt;trying to understand here, so what will be the values here for $0 and $1 ? (sorry I am very new to splunk props and transforms)&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 16:52:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429452#M20904</guid>
      <dc:creator>boomiagarg</dc:creator>
      <dc:date>2019-06-24T16:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically update index based on client hostname</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429453#M20905</link>
      <description>&lt;P&gt;&lt;CODE&gt;$0&lt;/CODE&gt; always contains the original value of the field mentioned in &lt;CODE&gt;DEST_KEY&lt;/CODE&gt;, &lt;CODE&gt;$1&lt;/CODE&gt; contains the content of the first capturing group from the &lt;CODE&gt;REGEX&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;So when you set &lt;CODE&gt;index=index1&lt;/CODE&gt; in inputs.conf and the host field contains &lt;CODE&gt;client1-acct1&lt;/CODE&gt;, then &lt;CODE&gt;$0&lt;/CODE&gt; will be &lt;CODE&gt;index1&lt;/CODE&gt; and &lt;CODE&gt;$1&lt;/CODE&gt; will be &lt;CODE&gt;acct1&lt;/CODE&gt;. And as such the result of the &lt;CODE&gt;FORMAT&lt;/CODE&gt; will be that after this transform &lt;CODE&gt;index&lt;/CODE&gt; will be &lt;CODE&gt;index1-acct1&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 07:11:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Dynamically-update-index-based-on-client-hostname/m-p/429453#M20905</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-06-25T07:11:40Z</dc:date>
    </item>
  </channel>
</rss>

