<?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: date_month localization and reporting for the previous month in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399367#M71156</link>
    <description>&lt;P&gt;Right on, I follow you now. Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Apr 2019 16:31:44 GMT</pubDate>
    <dc:creator>decoherence</dc:creator>
    <dc:date>2019-04-05T16:31:44Z</dc:date>
    <item>
      <title>date_month localization and reporting for the previous month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399361#M71150</link>
      <description>&lt;P&gt;Hello! Splunk n00b looking for confirmation of something! I can't find documentation for date_month that specifies whether it is localized. It appears that it isn't. Given this example search, which spans Feb 28 and Mar 1 in my timezone:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... earliest=1551384000 latest=1551416401
| eval date_month_local=strftime(_time, "%B")
| search date_month=march date_month_local=February
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which returns results claiming to be in both March and February starting at 7pm local (I'm UTC-0500). That makes sense if date_month is based on UTC.*&lt;/P&gt;

&lt;P&gt;Given that, if I have a report that I want to run on the previous month (Feb, in this example,) and I want a field with the name of the month in that report, should I be using strftime(_time, "%B") instead of date_month? If I use date_month, the report (which runs in -0500) ends up with a 'march' value for records after Feb 28 7pm -0500.&lt;/P&gt;

&lt;P&gt;If I haven't completely missed something then all this might seem a bit self evident (and hopefully helpful for someone.) There was some surprise amongst management when it seemed that date_month was not localized. That's why I want to be very sure I have this right. If anyone knows documentation that describes or implies how date_month treats timezones, I would appreciate being pointed at it.&lt;/P&gt;

&lt;P&gt;Thanks for your time!&lt;/P&gt;

&lt;P&gt;*UPDATE: As described by somesoni2 in the accepted answer, date_month is based on the literal string at index time. In this case, the indexer was looking at a timestamp field which happened to be in UTC.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:02:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399361#M71150</guid>
      <dc:creator>decoherence</dc:creator>
      <dc:date>2020-09-30T00:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: date_month localization and reporting for the previous month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399362#M71151</link>
      <description>&lt;P&gt;The &lt;CODE&gt;date_*&lt;/CODE&gt; fields are generated at index time and datetime values are the literal values parsed from the event when it is indexed, regardless of its timezone. So, the data might be generated, parsed and indexed on UTC time (check your indexer/heavy forwarder time zone) and then is translated to your timezone while searching. (See this for more information &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.4/Knowledge/Usedefaultfields#Default_datetime_fields"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.4/Knowledge/Usedefaultfields#Default_datetime_fields&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;The best way here would be to use _time based month calculation as that would honor your timezone/time range.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2019 19:10:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399362#M71151</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-04-04T19:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: date_month localization and reporting for the previous month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399363#M71152</link>
      <description>&lt;P&gt;Just to clarify my own understanding, my assumption that date_month is always based on UTC is not right? Instead, the value of date_month is dependent on the indexer/heavy forwarder (which in this case appears to be set to UTC)?&lt;/P&gt;

&lt;P&gt;Thanks again. I will look in to how to confirm the timezone configuration of our system.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:57:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399363#M71152</guid>
      <dc:creator>decoherence</dc:creator>
      <dc:date>2020-09-29T23:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: date_month localization and reporting for the previous month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399364#M71153</link>
      <description>&lt;P&gt;The &lt;CODE&gt;date_*&lt;/CODE&gt; are parsed based on the literal value of the time fields, regardless of the time zone. So for date string 05:22:21 will be parsed into indexed fields: date_hour::5 date_minute::22 date_second::21. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:57:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399364#M71153</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T23:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: date_month localization and reporting for the previous month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399365#M71154</link>
      <description>&lt;P&gt;I'm not sure I understand what you mean by 'literal value of the time fields.' Are you talking about unix epoch time?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 15:22:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399365#M71154</guid>
      <dc:creator>decoherence</dc:creator>
      <dc:date>2019-04-05T15:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: date_month localization and reporting for the previous month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399366#M71155</link>
      <description>&lt;P&gt;So if your raw data has timestamp as &lt;CODE&gt;2019-03-29 21:20:20 CST&lt;/CODE&gt; OR &lt;CODE&gt;2019-03-29 21:20:20 UTC&lt;/CODE&gt;, they both will have same date_* field values. It's always going to take 21 as date_hour, doesn't matter what the timezone is. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:58:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399366#M71155</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T23:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: date_month localization and reporting for the previous month</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399367#M71156</link>
      <description>&lt;P&gt;Right on, I follow you now. Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 16:31:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/date-month-localization-and-reporting-for-the-previous-month/m-p/399367#M71156</guid>
      <dc:creator>decoherence</dc:creator>
      <dc:date>2019-04-05T16:31:44Z</dc:date>
    </item>
  </channel>
</rss>

