<?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: Apply date offset for all date fields in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625950#M107555</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually, I'm using that right now.&amp;nbsp; I thought that can be done somehow in the props configurations and changing all date-time fields directly from there.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2023 07:25:54 GMT</pubDate>
    <dc:creator>vanheer</dc:creator>
    <dc:date>2023-01-05T07:25:54Z</dc:date>
    <item>
      <title>How to change all date fields with the correct time zone?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625699#M107537</link>
      <description>&lt;P&gt;I have data with multiple date fields in GMT time. when I import the data with setting the TZ=Europe/Berlin, I see that the _time in the correct time zone but for other date fields are still in GMT time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;props.conf:
[machine_log]
BREAK_ONLY_BEFORE_DATE=null
CHARSET=UTF-8
FIELD_DELIMITER = ,
FIELD_NAMES = DB_ID, DateOn, DateHist, DateOff, ExportTime, Item, Machine, Section
TIMESTAMP_FIELDS = DateOn, DateHist, DateOff, ExportTime
INDEXED_EXTRACTIONS=csv
KV_MODE=none
LINE_BREAKER=([\r\n]+)
NO_BINARY_CHECK=true
SHOULD_LINEMERGE=false
TZ=Europe/Berlin
category=Structured
disabled=false
pulldown_type=true&lt;/LI-CODE&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;
&lt;P&gt;I'm still getting data in this way:&lt;/P&gt;
&lt;TABLE border="1" width="96.875%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="12.5%"&gt;_time&lt;/TD&gt;
&lt;TD width="12.5%"&gt;DB_ID&lt;/TD&gt;
&lt;TD width="12.5%"&gt;DateOn&lt;/TD&gt;
&lt;TD width="12.5%"&gt;DateHist&lt;/TD&gt;
&lt;TD width="12.5%"&gt;DateOff&lt;/TD&gt;
&lt;TD width="12.5%"&gt;ExportTime&lt;/TD&gt;
&lt;TD width="12.5%"&gt;Item&lt;/TD&gt;
&lt;TD width="6.25%"&gt;Machine&lt;/TD&gt;
&lt;TD width="3.125%"&gt;Section&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%"&gt;&lt;SPAN&gt;2023-01-03 12:42:38.787&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="12.5%"&gt;B0123&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:41:52.897&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:42:38.787&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:42:38.787&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:42:38.787&lt;/TD&gt;
&lt;TD width="12.5%"&gt;I01&lt;/TD&gt;
&lt;TD width="6.25%"&gt;M01&lt;/TD&gt;
&lt;TD width="3.125%"&gt;S01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%"&gt;&lt;SPAN&gt;2023-01-03 12:41:43.847&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="12.5%"&gt;B0223&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:40:18.800&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:41:43.847&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:41:43.847&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2023-01-03 11:41:43.847&lt;/TD&gt;
&lt;TD width="12.5%"&gt;I12&lt;/TD&gt;
&lt;TD width="6.25%"&gt;MD1&lt;/TD&gt;
&lt;TD width="3.125%"&gt;S02&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index time in the correct time, but all date fields in the original timing with one hour offset.&lt;/P&gt;
&lt;P&gt;The question is:&amp;nbsp;How to change all date fields with the correct time zone?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 16:12:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625699#M107537</guid>
      <dc:creator>vanheer</dc:creator>
      <dc:date>2023-01-03T16:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Apply date offset for all date fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625720#M107539</link>
      <description>&lt;P&gt;Use the &lt;FONT face="courier new,courier"&gt;strptime()&lt;/FONT&gt; function to convert each date fields into epoch form and &lt;FONT face="courier new,courier"&gt;strftime()&lt;/FONT&gt; to convert them into a displayable format.&amp;nbsp; The former will put them into UTC and the latter will put them into the user's selected time zone.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 14:32:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625720#M107539</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-01-03T14:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Apply date offset for all date fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625950#M107555</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually, I'm using that right now.&amp;nbsp; I thought that can be done somehow in the props configurations and changing all date-time fields directly from there.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 07:25:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625950#M107555</guid>
      <dc:creator>vanheer</dc:creator>
      <dc:date>2023-01-05T07:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to change all date fields with the correct time zone?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625951#M107556</link>
      <description>&lt;P&gt;Adding a bit of explanation to &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt; 's advice.&lt;/P&gt;&lt;P&gt;If the event's date is parsed from the event, it's converted into a unix timestamp (number of seconds since epoch) and stored as a number within the _time field. By default when the _time field is displayed it's implicitly converted to a string using user's timezone settings so that's why _time is displayed as "2023-01-03 12:42:38.787" in your case (your user's webui TZ setting is GMT+1 I assume so if the timestamp is being parsed with the Europe/Berlin as configured and is displayed in the same timezone, it shows the same value of time).&lt;/P&gt;&lt;P&gt;But the rest of the fields (as well as the field that was used to calculate the _time of the event) are not parsed as timestamps. They are stored as strings so they contain the same raw value that was included in the event and are not processed in any way.&lt;/P&gt;&lt;P&gt;You could create a calculated field which would do a strftime(strptime()) of the original fields and they would show you the timestamps in your local timezone.&lt;/P&gt;&lt;P&gt;The best thing to do however would be to include timezone information in the timestamps themselves because any solution relying on assumed timezone is prone to generating errors if someone from another TZ worked with your data and/or in case of the TZ change (like daylight saving).&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 08:03:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625951#M107556</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-01-05T08:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to change all date fields with the correct time zone?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625962#M107558</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes I'm doing that using the calculated fields:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EVAL-DateOff
strftime(strptime(DateOff, "%F %H:%M:%S.%Q") + (strptime(strftime(strptime(DateOn, "%F %H:%M:%S.%Q"), "%c.%6N " . "UTC"), "%c.%6N %Z")-strptime(strftime(strptime(DateOn, "%F %H:%M:%S.%Q"), "%c.%6N " . "Europe/Berlin"), "%c.%6N %Z")), "%Y-%m-%d %H:%M:%S.%Q")

EVAL-DateOn
strftime(strptime(DateOn, "%F %H:%M:%S.%Q") + (strptime(strftime(strptime(DateOn, "%F %H:%M:%S.%Q"), "%c.%6N " . "UTC"), "%c.%6N %Z")-strptime(strftime(strptime(DateOn, "%F %H:%M:%S.%Q"), "%c.%6N " . "Europe/Berlin"), "%c.%6N %Z")), "%Y-%m-%d %H:%M:%S.%Q")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyway!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 08:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-all-date-fields-with-the-correct-time-zone/m-p/625962#M107558</guid>
      <dc:creator>vanheer</dc:creator>
      <dc:date>2023-01-05T08:37:40Z</dc:date>
    </item>
  </channel>
</rss>

