<?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: Timezone and Timestamp modification at search/report time? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16674#M2041</link>
    <description>&lt;P&gt;@biswabhusan yes, you run this on the search head&lt;/P&gt;</description>
    <pubDate>Fri, 04 May 2018 13:05:06 GMT</pubDate>
    <dc:creator>dajomas</dc:creator>
    <dc:date>2018-05-04T13:05:06Z</dc:date>
    <item>
      <title>Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16659#M2026</link>
      <description>&lt;P&gt;We have standardized our infrastructure on UTC,  but we want to generate reports in PST. Is there a way to specify a timezone transform at search time such that the events themselves don’t need to be modified? the link below would change the actual messages as they come in and I want to keep the data in splunk and my various raw syslog messages consistent. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/4.1.3/Admin/Applytimezoneoffsetstotimestamps" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.3/Admin/Applytimezoneoffsetstotimestamps&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2010 09:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16659#M2026</guid>
      <dc:creator>paymon</dc:creator>
      <dc:date>2010-07-01T09:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16660#M2027</link>
      <description>&lt;P&gt;Try using eval to subtract the difference between UTC and PST (in seconds).&lt;/P&gt;

&lt;P&gt;| eval _time=_time-28800&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2010 14:01:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16660#M2027</guid>
      <dc:creator>Jeremiah</dc:creator>
      <dc:date>2010-07-01T14:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16661#M2028</link>
      <description>&lt;P&gt;I too am attempting to view a report and have the times show up in a different time zone.&lt;/P&gt;

&lt;P&gt;Your solution simply changes the time, then displays this incorrect time in the "local" timezone so it appears correct.&lt;/P&gt;

&lt;P&gt;This does not seem correct to me. &lt;/P&gt;

&lt;P&gt;(Using an American example)
Let's say something happened at noon eastern time (-4:00).
This event correctly gets logged as happening at noon eastern, then I display it using my splunk server in the mountain time zone, it shows up as happening at 10:00 (which is correct).&lt;/P&gt;

&lt;P&gt;If I use your approach, I change the time so that the report thinks it happened at 14:00 eastern, then when that time is displayed for the mountain time zone, it shows up as 12:00.&lt;/P&gt;

&lt;P&gt;Although the string "12:00" is what I want, this seems a wrong way to do it.
This breaks if I decide to print out the timezone as well as the time.
It would then show up as "12:00 MST".  This also would be fragile if I started to correlate the times with anything else.&lt;/P&gt;

&lt;P&gt;What I would like is a way to say I want this report to show up in eastern time (even though the splunk server is in the mountain time zone), then all times would show up in the correct format no matter what.&lt;/P&gt;

&lt;P&gt;My other question is when I view a report on splunk (using the web interface), how does splunk decide what timezone to use for displaying the data, does it use the TZ environment variable of the splunk user on the server?  Does it use something in the browser (locale)?
Something else?  Can this be overwritten per user?&lt;/P&gt;

&lt;P&gt;-Kevin&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2010 02:39:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16661#M2028</guid>
      <dc:creator>kkalmbach</dc:creator>
      <dc:date>2010-07-03T02:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16662#M2029</link>
      <description>&lt;P&gt;Kevin,&lt;/P&gt;

&lt;P&gt;I am happy enough with Jeremiah's solution because the report is meant to be consumed by humans at meetings and I doubt anyone would care. That said, I am sure that some other use cases out there would not find this solution satisfactory and you are correct. If you find a proper solution please let us all know. Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2010 03:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16662#M2029</guid>
      <dc:creator>paymon</dc:creator>
      <dc:date>2010-07-05T03:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16663#M2030</link>
      <description>&lt;P&gt;You need to, at index time, set the time zone of your incoming data so that Splunk knows what the actual real event time is. If unspecified, Splunk assumes it is the same time zone as the Splunk indexer. &lt;/P&gt;

&lt;P&gt;When reporting, it will then display and normalize times to the time zone of the Splunk server. Unfortunately there isn't a simple way to change your user's current display time zone. However, it &lt;EM&gt;is&lt;/EM&gt; possible to set the time zone of a search head to something different from the indexer, and have all reports run from that search head, but use distributed search to query the indexer. The reports will be be displayed in the search head time zone, correctly adjusted regardless of the indexer's time zone. So by utilizing multiple search head instances you can have the data displayed in multiple zones.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2010 04:53:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16663#M2030</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-07-31T04:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16664#M2031</link>
      <description>&lt;P&gt;Could you handle daylight savings time dynamically?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 17:30:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16664#M2031</guid>
      <dc:creator>rgustafson</dc:creator>
      <dc:date>2012-07-11T17:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16665#M2032</link>
      <description>&lt;P&gt;I know this question is old, but it has 27K views, and no verified answer, and is the top SplunkBase result when I search "change timezone at search time," so it seems like it's still relevant.&lt;/P&gt;

&lt;P&gt;I had this problem as well; I have events that contain multiple time fields, and sometimes I want to sort those events based on, or otherwise display, time fields that are NOT the event's timestamp, and show those times in local time for human consumption.  To be clear, my log's indexed timestamps are processed correctly, but each event additionally has three more date-time fields that are input in UTC, and I would like to output them in local time.&lt;/P&gt;

&lt;P&gt;After searching for a long time through SplunkBase and the documentation with no results, I believe I've figured out a solution on my own.&lt;/P&gt;

&lt;P&gt;Assuming original time field &lt;CODE&gt;origtime&lt;/CODE&gt; is in format &lt;CODE&gt;%Y-%m-%d %T&lt;/CODE&gt; and is in UTC (but has no timezone notation in the original string):&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| replace * with "* UTC" in origtime &lt;BR /&gt;
| eval newctime = strptime(origtime,"%Y-%m-%d %T %Z") &lt;BR /&gt;
| eval newstrtime = strftime(newctime,"%Y-%m-%d %T")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If your original timestamp fields are in some other timezone, just change "UTC" to whatever your timezone value is.&lt;/P&gt;

&lt;P&gt;Output (reports) can now use &lt;CODE&gt;newstrtime&lt;/CODE&gt; as human-readable localized time; for machine-readable purposes (like sorting or timecharts) you can use &lt;CODE&gt;newctime&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Maybe better Splunkers can make a more elegant set of commands, but this appears to work for me.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2013 17:57:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16665#M2032</guid>
      <dc:creator>reickwort</dc:creator>
      <dc:date>2013-02-21T17:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16666#M2033</link>
      <description>&lt;P&gt;This doesn't seem to be true any more.  When I set my personal timezone to say UTC+8, when the Splunk data is stored in UTC, everything is adjusted to my local time.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2013 03:32:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16666#M2033</guid>
      <dc:creator>markmcd</dc:creator>
      <dc:date>2013-06-13T03:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16667#M2034</link>
      <description>&lt;P&gt;This only helps for the _time field. What about times stored in other fields?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2014 19:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16667#M2034</guid>
      <dc:creator>delink</dc:creator>
      <dc:date>2014-12-29T19:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16668#M2035</link>
      <description>&lt;P&gt;Am i missing something? PST = -7:00 of GMT, so this should be 7*60*60 = 25200. Why is it 28800?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16668#M2035</guid>
      <dc:creator>bschandramohan</dc:creator>
      <dc:date>2020-09-28T19:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16669#M2036</link>
      <description>&lt;P&gt;Pacific Time (PT) is -7 OR -8 of GMT depending on Daylight Saving Time. From winter to spring it's -8 (PST), from spring to winter it's -7 (PDT). &lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2015 22:42:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16669#M2036</guid>
      <dc:creator>daviduslan</dc:creator>
      <dc:date>2015-11-09T22:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16670#M2037</link>
      <description>&lt;P&gt;It has been 6 years since this question was asked but since I ran into this issue myself and found a solution that seems to work fine, I still would like to share it with the community.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval time_offset = strftime(_time,"%z")
| rex field=time_offset "(?&amp;lt;direction&amp;gt;[+-])(?&amp;lt;hour_offset&amp;gt;\d{2})\d{2}"
| eval date_hour = (date_hour + (hour_offset * if(direction=="-",-1,1))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Line 1 extracts the difference from UTC (ie. for CET it would result in +0200)&lt;BR /&gt;
Line 2 extracts the +/- and the first 2 digits&lt;BR /&gt;
Line 3 calculates the actual hour from the event's hour&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 10:48:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16670#M2037</guid>
      <dc:creator>dajomas</dc:creator>
      <dc:date>2016-10-27T10:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16671#M2038</link>
      <description>&lt;P&gt;There was an error in line 3 &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval date_hour = (date_hour + hour_offset) * if(direction=="-",-1,1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should have been&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval date_hour = (date_hour + (hour_offset * if(direction=="-",-1,1))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Oct 2016 05:34:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16671#M2038</guid>
      <dc:creator>dajomas</dc:creator>
      <dc:date>2016-10-28T05:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16672#M2039</link>
      <description>&lt;P&gt;Here's one way...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal | head 2 | table _time 
 | rename COMMENT as "The above just gets a couple of records for demonstration purposes."
 | eval myDateFormat="%Y-%m-%d %H:%M:%S.%3Q"
 | eval TimeDisp=strftime(_time,myDateFormat." %Z")
 | eval myTzName = "PST"
 | eval localDisp=strftime(2*_time-strptime(strftime(_time,myDateFormat." ".myTzName),myDateFormat." %Z"),myDateFormat)." ".myTzName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This takes the relevant time UTC, pretends it is local, then translates it back to UTC. It then applies whatever the difference in seconds was to the original time, then formats the result with the local time zone at the end. Set the values of myDateFormat and myTzName as desired.&lt;/P&gt;

&lt;P&gt;The method is for display only, not for changing the underlying data. It will get the wrong answer for a couple of hours each year when the calculation is performed across the hours that the time is changing to and from daylight savings. Worse, the method is in essence hardcoding the output expectation for the time zone (PST versus PDT), so the report results will be presenting a time zone that is not actually in effect during half the year. &lt;/P&gt;

&lt;P&gt;I also posted this solution here ... &lt;A href="https://answers.splunk.com/answers/523905/is-there-a-way-to-show-local-time-of-the-device-of.html"&gt;https://answers.splunk.com/answers/523905/is-there-a-way-to-show-local-time-of-the-device-of.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 22:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16672#M2039</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-24T22:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16673#M2040</link>
      <description>&lt;P&gt;Hi dajomas, will these exressions be run on on the search head?&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 11:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16673#M2040</guid>
      <dc:creator>biswabhusan</dc:creator>
      <dc:date>2018-05-03T11:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16674#M2041</link>
      <description>&lt;P&gt;@biswabhusan yes, you run this on the search head&lt;/P&gt;</description>
      <pubDate>Fri, 04 May 2018 13:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16674#M2041</guid>
      <dc:creator>dajomas</dc:creator>
      <dc:date>2018-05-04T13:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16675#M2042</link>
      <description>&lt;P&gt;I downvoted this post because epoch time!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 15:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16675#M2042</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2018-12-17T15:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16676#M2043</link>
      <description>&lt;P&gt;9 years later?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 15:59:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16676#M2043</guid>
      <dc:creator>Jeremiah</dc:creator>
      <dc:date>2019-01-11T15:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16677#M2044</link>
      <description>&lt;P&gt;I downvoted this post because does not contribute to the content of the post at all.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 19:39:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16677#M2044</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2019-01-31T19:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Timezone and Timestamp modification at search/report time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16679#M2046</link>
      <description>&lt;P&gt;The answer is as wrong now as it was 9 years ago.  Epoch time exists independent of time zones, but your answer alters epoch time without consideration for what epoch time is.  No sense continuing the nine years of confusion simply because no one noticed the mistake before.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 18:26:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timezone-and-Timestamp-modification-at-search-report-time/m-p/16679#M2046</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2019-02-02T18:26:08Z</dc:date>
    </item>
  </channel>
</rss>

