<?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 convert the time in raw data to different timezone? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604898#M210373</link>
    <description>&lt;P&gt;We don't know how those events look like. Maybe they include multiple time fields and the conversion needs to be done with some filed which was not used for _time calculation. In general I agree that such modifications to the _time field should be avoided.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2022 09:27:34 GMT</pubDate>
    <dc:creator>JacekF</dc:creator>
    <dc:date>2022-07-08T09:27:34Z</dc:date>
    <item>
      <title>How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/601361#M209292</link>
      <description>&lt;P&gt;I have the raw data where i need to convert the time in raw data to particular time zone&lt;BR /&gt;example:if the time contains emea in it i need to convert to CST time.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;his is the 3 conditions of time zone:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;when emea =&amp;gt; CEST/CST time&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;when apac =&amp;gt; HKT time&lt;/SPAN&gt;&lt;BR /&gt;when us=&amp;gt;EDT&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;6/10/22&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;9:39:00.000 AM&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;&lt;SPAN class=""&gt;2022-06-10&lt;/SPAN&gt; &lt;SPAN class=""&gt;15:39:00&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;emea&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;6/10/22&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;9:41:56.000 AM&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;&lt;SPAN class=""&gt;2022-06-10&lt;/SPAN&gt; &lt;SPAN class=""&gt;15:41:56&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;apac&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;6/10/22&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;9:41:56.000 AM&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;&lt;SPAN class=""&gt;2022-06-10&lt;/SPAN&gt; &lt;SPAN class=""&gt;15:41:56&lt;/SPAN&gt;&amp;nbsp;us&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me on the query&lt;BR /&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 14:33:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/601361#M209292</guid>
      <dc:creator>Veeru</dc:creator>
      <dc:date>2022-06-10T14:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/601381#M209298</link>
      <description>&lt;P&gt;You should be able to use the rex command to convert the regions into time zones then use strptime to parse the timestamps.&amp;nbsp; Once parsed, they'll be in UTC.&amp;nbsp; Splunk will convert them to the user's selected time zone.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed field=timestamp "s/emea/CEST/"
| rex mode=sed field=timestamp "s/apac/HKT/"
| rex mode=sed field=timestamp "s/us/EDT/"
| eval ts= strptime(timestamp, "%Y-%m-%d %H:%M:%S %Z")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Jun 2022 15:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/601381#M209298</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-06-10T15:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/601542#M209352</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; This not giving us the timestamp field even&lt;BR /&gt;&lt;BR /&gt;My issue is when emea comes it should show us the cst time and as well when apac comes it should show us the hongkong time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for replying&lt;BR /&gt;veera&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 12:57:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/601542#M209352</guid>
      <dc:creator>Veeru</dc:creator>
      <dc:date>2022-06-13T12:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604793#M210344</link>
      <description>&lt;P&gt;Hello All,&lt;BR /&gt;&lt;BR /&gt;I want to convert the UTC time to 3 different time zones as i mentioned in previous message&lt;BR /&gt;can&amp;nbsp; anyone please help me out on this.&lt;BR /&gt;&amp;nbsp;Basically when time zone consists of emea in it should be convert to CST time&lt;BR /&gt;&lt;SPAN class=""&gt;2022-06-10&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;15:39:00&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;emea -&amp;gt;&amp;nbsp;&amp;nbsp;2022-06-10&lt;SPAN&gt;&amp;nbsp; 10:39:00 CST and viceversa&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Thank you in advance&lt;BR /&gt;veeru&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 15:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604793#M210344</guid>
      <dc:creator>Veeru</dc:creator>
      <dc:date>2022-07-07T15:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604859#M210359</link>
      <description>&lt;P&gt;Short of doing very nasty tricks and pretending that the time is in fact a completely different timestamp than it really is you can't display a timestamp in a different timezone than the one your user is configured with.&lt;/P&gt;&lt;P&gt;As simple as that.&lt;/P&gt;&lt;P&gt;I know it's sometimes annoying if you want to be able to - for example - switch from one timezone to another to check what the situation looks like for - for example - another team in your multinational corpo. But time manipulation is sufficiently complicated as it is and _not_ being able to render timestamp in arbitrary timezones (possibly omitting the timezone info from resulting string) saves everyone a lot of headaches.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 20:59:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604859#M210359</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-07-07T20:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604890#M210368</link>
      <description>&lt;P&gt;I'm not sure what do you mean by us, apac or emea time zones. But if you know what is the time difference between us and EDT, apac and HKT, emea and CST time zones, you can use relative_time function to make the time conversions:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval timestamp="2022-06-10 15:39:00 emea,2022-06-10 15:41:56 apac,2022-06-10 15:41:56 us"
| makemv timestamp delim=","
| mvexpand timestamp
| rex field=timestamp "\s(?&amp;lt;tz&amp;gt;[\w]+)$"
| eval time = strptime(timestamp, "%Y-%m-%d %H:%M:%S")
| eval time = case(
    tz=="us", strftime(relative_time(time, "+2h"), "%m/%e/%Y %I:%M:%S %p")+" EDT",
    tz=="apac", strftime(relative_time(time, "-2h"), "%m/%e/%Y %I:%M:%S %p")+" HKT",
    tz=="emea", strftime(relative_time(time, "-6h"), "%m/%e/%Y %I:%M:%S %p")+" CST"
)&lt;/LI-CODE&gt;&lt;P&gt;The values I've provided to relative_time for the time specifier argument, probably do not have much sense. You will have to adjust them to properly convert time zones.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 07:59:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604890#M210368</guid>
      <dc:creator>JacekF</dc:creator>
      <dc:date>2022-07-08T07:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604892#M210369</link>
      <description>&lt;P&gt;That's what I meant by nasty tricks. You're not rendering a given timestamp but you're adjusting the _time to a deliberately wrong value to render it to a wrong value _in your local timezone_ and then you add a predefined string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 08:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604892#M210369</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-07-08T08:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604893#M210370</link>
      <description>&lt;P&gt;I'm not adjusting _time, just creating a new "time" field with converted time zone. I'm not sure if the question was about changing the value of the _time field.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 08:49:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604893#M210370</guid>
      <dc:creator>JacekF</dc:creator>
      <dc:date>2022-07-08T08:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604896#M210372</link>
      <description>&lt;P&gt;OK, you may not be modifying the _time field value itself. That's not the point. The point is that the value you're calculating the string representation is not equal to the _time value. It's skewed with a predefined offset.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 09:15:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604896#M210372</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-07-08T09:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604898#M210373</link>
      <description>&lt;P&gt;We don't know how those events look like. Maybe they include multiple time fields and the conversion needs to be done with some filed which was not used for _time calculation. In general I agree that such modifications to the _time field should be avoided.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 09:27:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604898#M210373</guid>
      <dc:creator>JacekF</dc:creator>
      <dc:date>2022-07-08T09:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time in raw data to different timezone?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604900#M210374</link>
      <description>&lt;P&gt;It's not about the events themselves &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; _time is _time.&lt;/P&gt;&lt;P&gt;As I understand the "problem" - there is a timestamp - possibly parsed out from the event - which as we know is internally stored as number of seconds since epoch and is completely "timezoneless". And OP wants to render it in different timezone than user's configured timezone. Splunk as such doesn't allow it. The strftime converts given timestamp to a string but the timezone is not-configurable. It's always the one configured for the user "globally". And there is no way around it.&lt;/P&gt;&lt;P&gt;What I meant and what you showed is rendering a completely different value of timestamp to make the string representation appear "correct". It "works" meaning that it should produce expected string values but is prone to cause much confusion and errors later when everyone forgets how it's done, when the daylight saving kicks and so on.&lt;/P&gt;&lt;P&gt;Unfortunately, time calculations can be annoying and timezone differences can be confusing.&lt;/P&gt;&lt;P&gt;I suppose I'd advise &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/241633"&gt;@Veeru&lt;/a&gt; to keep the time rendered in user's timezone but maybe give for reference some predefined timestamps in other timezones rendered in user's timezone.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 09:35:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-time-in-raw-data-to-different-timezone/m-p/604900#M210374</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-07-08T09:35:43Z</dc:date>
    </item>
  </channel>
</rss>

