<?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: How to set time zone dynamically based on host name? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485169#M83048</link>
    <description>&lt;P&gt;Awesome @joesrepsolc, glad to see that it worked for you !&lt;/P&gt;</description>
    <pubDate>Tue, 24 Sep 2019 03:46:31 GMT</pubDate>
    <dc:creator>DavidHourani</dc:creator>
    <dc:date>2019-09-24T03:46:31Z</dc:date>
    <item>
      <title>How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485166#M83045</link>
      <description>&lt;P&gt;I've got 95% of this new input working, but was hoping to also configure the TZ (dynamically) based on the host name value. Would like to set the correct time zone based on the hostname starting with "CA" or "KC". I have the timezone settings to add to the props.conf just can't seem to figure out how to do this based on the host name.&lt;/P&gt;

&lt;P&gt;How can I do that in my props.conf?? dataset is the same format, so was hoping to do this in the single props.conf file.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;if host=CA* then TZ=America/Chicago&lt;BR /&gt;
if host=KC* then TZ=America/Los_Angeles&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;current PROPS.CONF&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype_name]
SHOULD_LINEMERGE=true
LINE_BREAKER=([\r\n]+)
NO_BINARY_CHECK=true
CHARSET=UTF-8
disabled=false
TIME_FORMAT=%Y-%m-%d %H:%M:%S.%Q
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Sep 2019 16:31:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485166#M83045</guid>
      <dc:creator>joesrepsolc</dc:creator>
      <dc:date>2019-09-23T16:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485167#M83046</link>
      <description>&lt;P&gt;Hi @joesrepsolc,&lt;/P&gt;

&lt;P&gt;You can do this by including stanzas based on the &lt;CODE&gt;host&lt;/CODE&gt; instead of &lt;CODE&gt;sourcetype&lt;/CODE&gt; only. It should look something like that in your &lt;CODE&gt;props.conf&lt;/CODE&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host::CA*]
TZ = America/Chicago

[host::KC*]
TZ = America/Los_Angeles
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know how that works out for you.&lt;/P&gt;

&lt;P&gt;You can see some more example here:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/Admin/Propsconf#props.conf.example"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/Admin/Propsconf#props.conf.example&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 17:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485167#M83046</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-09-23T17:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485168#M83047</link>
      <description>&lt;P&gt;I just put all those into a single props.conf and it WORKS. Awesome.&lt;/P&gt;

&lt;P&gt;So the incoming data will hit the 1st stanza (sourcetype) and process through that, and also hit the matching hostname stanza, and process through that as well. I was under the initial impression that it only matched 1 stanza, and that's where I was stuck.&lt;/P&gt;

&lt;P&gt;Thank You.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 20:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485168#M83047</guid>
      <dc:creator>joesrepsolc</dc:creator>
      <dc:date>2019-09-23T20:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485169#M83048</link>
      <description>&lt;P&gt;Awesome @joesrepsolc, glad to see that it worked for you !&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 03:46:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/485169#M83048</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-09-24T03:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/519743#M87881</link>
      <description>&lt;P&gt;Hello,&amp;nbsp; We have a similar but slightly different situation.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Will implementing the host:: stanza impact ALL sourcetypes from the host caught by the filter?&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;We have for example IIS logs which are in UTC and then application logs based on datacenter timezones,&amp;nbsp; CSTCDT&amp;nbsp; or ESTEDT.&amp;nbsp; &amp;nbsp; We tried host:: based on hostname/datacenter/location.&amp;nbsp; But now our IIS logs are coming in, in the future.&amp;nbsp; &amp;nbsp; Any suggestions?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 15:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/519743#M87881</guid>
      <dc:creator>pretzel2</dc:creator>
      <dc:date>2020-09-15T15:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/519998#M87919</link>
      <description>&lt;P&gt;We found a solution that worked in our case.&lt;/P&gt;&lt;P&gt;We have windows servers in two different data centers, in different time zones. The application log files in each are using the local time zone for the timestamp.&amp;nbsp; &amp;nbsp;We were going to switch based on hostname BUT that introduced problems where log file like IIS which are in UTC, everywhere.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We found in the documentation for props.conf that if TZ for a sourcetype stanza is NOT specified, it will default (use) the servers local time stamp.&amp;nbsp; That worked for us.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;TZ = &amp;lt;timezone identifier&amp;gt;
* The algorithm for determining the time zone for a particular event is as
  follows:
  * If the event has a timezone in its raw text (for example, UTC, -08:00),
  use that.
  * If TZ is set to a valid timezone string, use that.
  * If the event was forwarded, and the forwarder-indexer connection uses
  the version 6.0 and higher forwarding protocol, use the timezone provided
  by the forwarder.
  * Otherwise, use the timezone of the system that is running splunkd.
* Default: empty string&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 18:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/519998#M87919</guid>
      <dc:creator>pretzel2</dc:creator>
      <dc:date>2020-09-16T18:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/543885#M90777</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;joesrepsolc,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can you tell me how you have given the stanza for a particular host? Like below?&lt;/P&gt;&lt;P&gt;[sourcetype_name]&lt;BR /&gt;SHOULD_LINEMERGE=true&lt;BR /&gt;LINE_BREAKER=([\r\n]+)&lt;BR /&gt;NO_BINARY_CHECK=true&lt;BR /&gt;CHARSET=UTF-8&lt;BR /&gt;disabled=false&lt;BR /&gt;TIME_FORMAT=%Y-%m-%d %H:%M:%S.%Q&lt;/P&gt;&lt;P&gt;[hostname]&lt;BR /&gt;SHOULD_LINEMERGE=true&lt;BR /&gt;LINE_BREAKER=([\r\n]+)&lt;BR /&gt;NO_BINARY_CHECK=true&lt;BR /&gt;CHARSET=UTF-8&lt;BR /&gt;disabled=false&lt;BR /&gt;TIME_FORMAT=%Y-%m-%d %H:%M:%S.%Q&lt;BR /&gt;TZ=timezone*&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 15:38:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/543885#M90777</guid>
      <dc:creator>nbr</dc:creator>
      <dc:date>2021-03-15T15:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/543901#M90779</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223439"&gt;@nbr&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You should write host based stanza like below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[host::hostname]
SHOULD_LINEMERGE=true
LINE_BREAKER=([\r\n]+)
NO_BINARY_CHECK=true
CHARSET=UTF-8
disabled=false
TIME_FORMAT=%Y-%m-%d %H:%M:%S.%Q
TZ=timezone*&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 Mar 2021 17:15:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/543901#M90779</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-03-15T17:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/543960#M90785</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061" target="_self"&gt;&lt;SPAN class=""&gt;@scelikok&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I have given,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;[host::hostname]&lt;BR /&gt;SHOULD_LINEMERGE = true&lt;BR /&gt;LINE_BREAKER = ([\r\n]+)&lt;BR /&gt;MAX_TIMESTAMP_LOOKAHEAD = 128&lt;BR /&gt;NO_BINARY_CHECK = true&lt;BR /&gt;CHARSET = UTF-8&lt;BR /&gt;disabled = false&lt;BR /&gt;TIME_FORMAT = %Y-%m-%d %H:%M:%S.%Q&lt;BR /&gt;TZ = Asia/Dubai&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;But the logs from that particular host is getting indexed in UTC timings. The server time zone has been set to UTC and that cannot be changed. Is there anything we can do from Splunk end?&lt;BR /&gt;&lt;BR /&gt;I already been tried to point the time zone to datetime.xml file in the HF, but no luck.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 08:36:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/543960#M90785</guid>
      <dc:creator>nbr</dc:creator>
      <dc:date>2021-03-16T08:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/695600#M115485</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/68181"&gt;@DavidHourani&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have a similar kind of requirement, but I have the hostnames coming in as IPs.&lt;/P&gt;
&lt;P&gt;There are too many IPs and difficult to add everything one by one and also, there is a possibility some new IPs also come in at later point.&lt;/P&gt;
&lt;P&gt;Can I try something like [host::10.24.*] ?&lt;/P&gt;
&lt;P&gt;I tried it and seems not working. If it is not possible to use wildcard with IP for host based settings, what else would you suggest?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 00:07:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/695600#M115485</guid>
      <dc:creator>Arokiaraj1991</dc:creator>
      <dc:date>2024-08-08T00:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set time zone dynamically based on host name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/695645#M115489</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should work with IP addresses, if your data is going through an HF before reaching an indexer then the config should be applied on the HF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if it works for you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 06:03:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-time-zone-dynamically-based-on-host-name/m-p/695645#M115489</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2024-08-08T06:03:49Z</dc:date>
    </item>
  </channel>
</rss>

