<?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: Can I dynamically set the default host value using a Universal Forwarder? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389767#M69756</link>
    <description>&lt;P&gt;Hi psyched4splunk,&lt;BR /&gt;
let me understand: you want to dinamically set the hostname based on the "containername" part of the pa, is it correct?&lt;BR /&gt;
if this is your need you have to add to the monitor stanza in inputs.conf, the following option:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host_segment = 4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in this way you dinamically set the hostname as the 4th part of the path.&lt;BR /&gt;
You can find more information at &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2019 16:37:16 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-07-16T16:37:16Z</dc:date>
    <item>
      <title>Can I dynamically set the default host value using a Universal Forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389766#M69755</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I'm using host_regex on a Universal Forwarder.&lt;/STRONG&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;H1&gt;inputs.conf&lt;/H1&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///app/splunkforwarder/logs/containername/*.log]
interval = 1800
host_regex = \/app\/splunkforwarder\/logs\/(.*?)\/*.log
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;STRONG&gt;From my understanding this should set container name as the host_regex.&lt;BR /&gt;
However this isn't working, what am I doing wrong and how can I fix it?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 15:28:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389766#M69755</guid>
      <dc:creator>psyched4splunk</dc:creator>
      <dc:date>2019-07-16T15:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can I dynamically set the default host value using a Universal Forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389767#M69756</link>
      <description>&lt;P&gt;Hi psyched4splunk,&lt;BR /&gt;
let me understand: you want to dinamically set the hostname based on the "containername" part of the pa, is it correct?&lt;BR /&gt;
if this is your need you have to add to the monitor stanza in inputs.conf, the following option:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host_segment = 4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in this way you dinamically set the hostname as the 4th part of the path.&lt;BR /&gt;
You can find more information at &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 16:37:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389767#M69756</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-07-16T16:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can I dynamically set the default host value using a Universal Forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389768#M69757</link>
      <description>&lt;P&gt;See if this helps you at alll.  &lt;/P&gt;

&lt;P&gt;host_regex = \/app\/splunkforwarder\/logs\/(\w+)\/\w+.log$&lt;/P&gt;

&lt;P&gt;Unless there are special characters in your path this should capture the containername.  I believe your regex was erroring because of the *.log.  &lt;/P&gt;

&lt;P&gt;(I could be wrong.  Hopefully this helps) &lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 16:38:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389768#M69757</guid>
      <dc:creator>kgderrekchapin</dc:creator>
      <dc:date>2019-07-16T16:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can I dynamically set the default host value using a Universal Forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389769#M69758</link>
      <description>&lt;P&gt;Yes that's correct. &lt;BR /&gt;
&lt;STRONG&gt;However&lt;/STRONG&gt; a more important part of my question is if setting host_segment and host_regex is dependent on the forwarder? &lt;BR /&gt;
Can I dynamically set the host on a universal forwarder or no? &lt;BR /&gt;
I haven't found a clear answer to this question.&lt;BR /&gt;
I ask because I'm trying to do it on the Universal Forward and it's not working for me as I've included my inputs.conf above.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:19:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389769#M69758</guid>
      <dc:creator>psyched4splunk</dc:creator>
      <dc:date>2020-09-30T01:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I dynamically set the default host value using a Universal Forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389770#M69759</link>
      <description>&lt;P&gt;Where are you trying to set the hostname at?&lt;BR /&gt;&lt;BR /&gt;
The host that has the UF installed on it.&lt;BR /&gt;&lt;BR /&gt;
Or the inputs.conf from the deployed app on the UF.   (this will set the hostname for the logs ingested by the input.conf stanza) &lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 17:15:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389770#M69759</guid>
      <dc:creator>kgderrekchapin</dc:creator>
      <dc:date>2019-07-16T17:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can I dynamically set the default host value using a Universal Forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389771#M69760</link>
      <description>&lt;P&gt;The host that has the UF installed on it.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 19:29:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389771#M69760</guid>
      <dc:creator>psyched4splunk</dc:creator>
      <dc:date>2019-07-16T19:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I dynamically set the default host value using a Universal Forwarder?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389772#M69761</link>
      <description>&lt;P&gt;Hi psyched4splunk,&lt;/P&gt;

&lt;P&gt;if you want to dinamically set the hostname for your logs based on a segment of the path of your logs you can do it, it doesn't depends on the forwarder: the host_segment depends on the input you have to ingest, not on the forwarder.&lt;BR /&gt;
In other words, you have to configure an input.conf for your logs, setting the correct host_segment for every monitor stanza (eventually more than one) and then deploy it on your forwarders manually or (better) using a Deployment Server.&lt;/P&gt;

&lt;P&gt;When you say the "it's not working for me", what do you mean? can you describe more your situation?&lt;/P&gt;

&lt;P&gt;As you can read at &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf&lt;/A&gt; , the hostname id defined by default when the Forwarder is installed, then it's possible to set a different hostname in each stanza of your inputs.conf file using different options (host=, host_segment=, host_regex=) so the most important thing is to clearly define your needs and set them in inputs.conf, then deploy (manually or using a Deployment Server) your app containing your inputs.conf to each forwarder.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:23:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-dynamically-set-the-default-host-value-using-a-Universal/m-p/389772#M69761</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T01:23:49Z</dc:date>
    </item>
  </channel>
</rss>

