<?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: Splunk date time format in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221094#M98883</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;UPDATED TO SHOW MONTH&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=x mode=sed "s/(?&amp;lt;dt&amp;gt;\w{3,4}\s\d\d?)([snrt][hd]),\s?(?&amp;lt;yr&amp;gt;\d{4})/\1, \3/g" | eval y=strptime(x,"%B %-d, %Y") | eval date=strftime(y, "%Y-%m")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Aug 2016 13:03:52 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-08-10T13:03:52Z</dc:date>
    <item>
      <title>Splunk date time format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221093#M98882</link>
      <description>&lt;P&gt;In splunk, I have a file which has date in the format June 16th,2014 and I am trying to extract out the month_year variable in the format 2014-06.&lt;/P&gt;

&lt;P&gt;Any help will be appreciated.&lt;/P&gt;

&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 04:09:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221093#M98882</guid>
      <dc:creator>singhnitin</dc:creator>
      <dc:date>2016-08-10T04:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date time format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221094#M98883</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;UPDATED TO SHOW MONTH&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=x mode=sed "s/(?&amp;lt;dt&amp;gt;\w{3,4}\s\d\d?)([snrt][hd]),\s?(?&amp;lt;yr&amp;gt;\d{4})/\1, \3/g" | eval y=strptime(x,"%B %-d, %Y") | eval date=strftime(y, "%Y-%m")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Aug 2016 13:03:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221094#M98883</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-10T13:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date time format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221095#M98884</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "(?&amp;lt;month&amp;gt;\w+)\s\d+\w\w,(?&amp;lt;year&amp;gt;\d\d\d\d)" | eval MON=case(month == "Nov", "11", month == "July", "7", month == "June", "6", month == "Aug", "8") |  eval date=year."-".MON | table date MON, year _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it gives this output - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;date    MON year    _raw
2014-11 11  2014    the format Nov 10th,2014 and extract out the month_year  in the format 2014-06.
2014-8  8   2014    the format Aug 6th,2014 and extract out the month_year  in the format 2014-06.
2014-7  7   2014    the format July 1st,2014 and extract out the month_year  in the format 2014-06.
2014-6  6   2014    the format June 16th,2014 and extract out the month_year  in the format 2014-06.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Aug 2016 13:44:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221095#M98884</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-08-10T13:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date time format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221096#M98885</link>
      <description>&lt;P&gt;Sir, i am trying this one.. but its not working. also may i know, what this one does - ([snrt][hd]) please&lt;/P&gt;

&lt;P&gt;sourcetype=monthyear | rex field=_raw mode=sed "s/(?&lt;DL&gt;&lt;DT&gt;\w{3,4}\s\d\d?)([snrt][hd]),\s?(?\d{4})/\1, \3/g" | table dt yr _raw&lt;/DT&gt;&lt;/DL&gt;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 16:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221096#M98885</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-08-10T16:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date time format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221097#M98886</link>
      <description>&lt;P&gt;Try like this (run anywhere sample)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval date="June 16th,2014" | table date| eval date_month=strftime(strptime(replace(date,"(\w+)([^,]+),(\d+)","1 \1 \3"),"%d %B %Y"),"%Y-%m")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Aug 2016 16:58:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221097#M98886</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-10T16:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk date time format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221098#M98887</link>
      <description>&lt;P&gt;Since you date can have st, nd, rd, th after the date, ([snrt][hd]) in the &lt;CODE&gt;rex&lt;/CODE&gt; command is to remove those chars to it can be formatted into a epoch time.&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;rex&lt;/CODE&gt; command assume you have the date extracted into a field called &lt;CODE&gt;x&lt;/CODE&gt;. if you don't have the date extracted, remove the &lt;CODE&gt;field=x&lt;/CODE&gt; and try it. Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/(?&amp;lt;dt&amp;gt;\w{3,4}\s\d\d?)([snrt][hd]),\s?(?&amp;lt;yr&amp;gt;\d{4})/\1, \3/g" | eval y=strptime(x,"%B %-d, %Y") | eval date=strftime(y, "%Y-%m")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Aug 2016 17:25:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-date-time-format/m-p/221098#M98887</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-10T17:25:21Z</dc:date>
    </item>
  </channel>
</rss>

