<?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 Parsing in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Date-Parsing/m-p/172602#M186525</link>
    <description>&lt;P&gt;The problem is that there is no punctuation between your day-of-month and hour-of-day so when hour-of-day is 0 (or "00"), Splunk consumes both is as part of day-of-month (e.g. "0600"-&amp;gt;"6"-&amp;gt;June).&lt;/P&gt;

&lt;P&gt;There are 2 options; you can use &lt;CODE&gt;datetime.xml&lt;/CODE&gt; to do it yourself or you can use &lt;CODE&gt;resortdate&lt;/CODE&gt; to reformat the timestamp in the raw event to add punctuation and then use the normal stuff you already had (with a tweak):&lt;/P&gt;

&lt;P&gt;Option 1 datetime.xml:&lt;/P&gt;

&lt;P&gt;&amp;lt;datetime&amp;gt;&lt;BR /&gt;
&amp;lt;define name="_nospacedate" extract="year, month, day"&amp;gt;&lt;BR /&gt;
    &amp;lt;text&amp;gt;[(\d{4})-(\d{2})-(\d{2})&amp;lt;/text&amp;gt;&lt;BR /&gt;
&amp;lt;/define&amp;gt;&lt;BR /&gt;
   &amp;lt;define name="_nospacetime" extract="hour, minute, second"&amp;gt;&lt;BR /&gt;
&amp;lt;text&amp;gt;[\d{4}-\d{2}-\d{2}(\d{2}):(\d{2}):(\d{2})&amp;lt;/text&amp;gt;&lt;BR /&gt;
    &amp;lt;/define&amp;gt;&lt;BR /&gt;
&amp;lt;timePatterns&amp;gt;&lt;BR /&gt;
   &amp;lt;use name="_nospacetime"/&amp;gt;&lt;BR /&gt;
&amp;lt;/timePatterns&amp;gt;&lt;BR /&gt;
&amp;lt;datePatterns&amp;gt;&lt;BR /&gt;
   &amp;lt;use name="_nospacedate"/&amp;gt;&lt;BR /&gt;
&amp;lt;/datePatterns&amp;gt;&lt;BR /&gt;
&amp;lt;/datetime&amp;gt;&lt;/P&gt;

&lt;P&gt;Option 1 props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mySourcetype]
DATETIME_CONFIG = /etc/apps/MyApp/default/datetime.xml
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option 2 transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[resortdate]
REGEX = (\d{4})-(\d{2})-(\d{2})(\d{2}):(\d{2}):(\d{2})
FORMAT = $1-$2-$3 $4:$5:$6
DEST_KEY = _raw 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option 2 props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mySourcetype]
TRANSFORMS-sortdate = resortdate
TIME_PREFIX = [
TIME_FORMAT = %Y-%m-%d %H:%M:%S
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Sep 2020 19:50:39 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2020-09-28T19:50:39Z</dc:date>
    <item>
      <title>Date Parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-Parsing/m-p/172600#M186523</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;

&lt;P&gt;I am collecting some application logs as below.&lt;/P&gt;

&lt;P&gt;Splunk can parse my log very well if the timestamp shows like below.&lt;BR /&gt;
[2015-05-0609:04:03:681][26411196]: log content...&lt;/P&gt;

&lt;P&gt;But if the hour is "00", it seems that Splunk cann't parse the date. And which it leads me AggregatorMiningProcessor errors.&lt;BR /&gt;
[2015-05-0600:04:03:681][26411196]: log content...&lt;/P&gt;

&lt;P&gt;I have tried to put time_format in props.conf but everything behaved the same. &lt;BR /&gt;
[mysourcetype]&lt;BR /&gt;
TIME_PREFIX = [&lt;BR /&gt;
TIME_FORMAT = %Y-%m-%d%H:%M:%S&lt;/P&gt;

&lt;P&gt;Any idea for me? Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:44:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-Parsing/m-p/172600#M186523</guid>
      <dc:creator>simontam</dc:creator>
      <dc:date>2020-09-28T19:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date Parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-Parsing/m-p/172601#M186524</link>
      <description>&lt;P&gt;Have you tried to look at how things look during the "Add Data" wizard? Maybe the step in which splunk tries to parse the timestamp can show you further details as to why it fails. You should see some kind of warning on events which have "00" as hour, along a hint with what is wrong.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 13:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-Parsing/m-p/172601#M186524</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-05-06T13:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Date Parsing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-Parsing/m-p/172602#M186525</link>
      <description>&lt;P&gt;The problem is that there is no punctuation between your day-of-month and hour-of-day so when hour-of-day is 0 (or "00"), Splunk consumes both is as part of day-of-month (e.g. "0600"-&amp;gt;"6"-&amp;gt;June).&lt;/P&gt;

&lt;P&gt;There are 2 options; you can use &lt;CODE&gt;datetime.xml&lt;/CODE&gt; to do it yourself or you can use &lt;CODE&gt;resortdate&lt;/CODE&gt; to reformat the timestamp in the raw event to add punctuation and then use the normal stuff you already had (with a tweak):&lt;/P&gt;

&lt;P&gt;Option 1 datetime.xml:&lt;/P&gt;

&lt;P&gt;&amp;lt;datetime&amp;gt;&lt;BR /&gt;
&amp;lt;define name="_nospacedate" extract="year, month, day"&amp;gt;&lt;BR /&gt;
    &amp;lt;text&amp;gt;[(\d{4})-(\d{2})-(\d{2})&amp;lt;/text&amp;gt;&lt;BR /&gt;
&amp;lt;/define&amp;gt;&lt;BR /&gt;
   &amp;lt;define name="_nospacetime" extract="hour, minute, second"&amp;gt;&lt;BR /&gt;
&amp;lt;text&amp;gt;[\d{4}-\d{2}-\d{2}(\d{2}):(\d{2}):(\d{2})&amp;lt;/text&amp;gt;&lt;BR /&gt;
    &amp;lt;/define&amp;gt;&lt;BR /&gt;
&amp;lt;timePatterns&amp;gt;&lt;BR /&gt;
   &amp;lt;use name="_nospacetime"/&amp;gt;&lt;BR /&gt;
&amp;lt;/timePatterns&amp;gt;&lt;BR /&gt;
&amp;lt;datePatterns&amp;gt;&lt;BR /&gt;
   &amp;lt;use name="_nospacedate"/&amp;gt;&lt;BR /&gt;
&amp;lt;/datePatterns&amp;gt;&lt;BR /&gt;
&amp;lt;/datetime&amp;gt;&lt;/P&gt;

&lt;P&gt;Option 1 props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mySourcetype]
DATETIME_CONFIG = /etc/apps/MyApp/default/datetime.xml
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option 2 transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[resortdate]
REGEX = (\d{4})-(\d{2})-(\d{2})(\d{2}):(\d{2}):(\d{2})
FORMAT = $1-$2-$3 $4:$5:$6
DEST_KEY = _raw 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option 2 props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mySourcetype]
TRANSFORMS-sortdate = resortdate
TIME_PREFIX = [
TIME_FORMAT = %Y-%m-%d %H:%M:%S
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-Parsing/m-p/172602#M186525</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-09-28T19:50:39Z</dc:date>
    </item>
  </channel>
</rss>

