<?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 extract time from events but date from modification time in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/extract-time-from-events-but-date-from-modification-time/m-p/82942#M17211</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I've read &lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.3/Data/Configuretimestamprecognition"&gt;Precedence rules for timestamp assignment&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;What I want is to extract &lt;STRONG&gt;&lt;EM&gt;time)&lt;/EM&gt;&lt;/STRONG&gt;(hour,minute,second,millisecond) from events but &lt;STRONG&gt;&lt;EM&gt;date&lt;/EM&gt;&lt;/STRONG&gt;(month,day,year) from &lt;STRONG&gt;modification time&lt;/STRONG&gt;, because my log is like this : &lt;/P&gt;

&lt;P&gt;[073242:123] xxx xxx xxx ...&lt;/P&gt;

&lt;P&gt;which:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;07&lt;/STRONG&gt; is for &lt;STRONG&gt;hour&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;32&lt;/STRONG&gt; is for &lt;STRONG&gt;minute&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;42&lt;/STRONG&gt; is for &lt;STRONG&gt;second&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;123&lt;/STRONG&gt; is for &lt;STRONG&gt;millisecond&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;and I need to get &lt;STRONG&gt;&lt;EM&gt;date&lt;/EM&gt;&lt;/STRONG&gt; from &lt;STRONG&gt;modification time&lt;/STRONG&gt; because I don't have date info in the events and the log file is created daily.&lt;/P&gt;

&lt;P&gt;According to &lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.3/Data/Configuretimestamprecognition"&gt;Precedence rules for timestamp assignment&lt;/A&gt;,&lt;/P&gt;

&lt;P&gt;I try to set &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_PREFIX = ^[&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_FORMAT = %H%M%S:%Q&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;in props.conf and I get the right &lt;STRONG&gt;&lt;EM&gt;time&lt;/EM&gt;&lt;/STRONG&gt; but wrong &lt;STRONG&gt;&lt;EM&gt;date&lt;/EM&gt;&lt;/STRONG&gt;(splunk gets the system date for me)&lt;/P&gt;

&lt;P&gt;Besides, theoretically I can let &lt;STRONG&gt;modification time&lt;/STRONG&gt; extracted for my event date by setting &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;DATETIME_CONFIG = NONE&lt;/STRONG&gt; in props.conf, but it failed. I still get &lt;STRONG&gt;&lt;EM&gt;time&lt;/EM&gt;&lt;/STRONG&gt; that the log be indexed.&lt;/P&gt;

&lt;P&gt;And even &lt;STRONG&gt;DATETIME_CONFIG = NONE&lt;/STRONG&gt; works for my event date it will fail on &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_PREFIX = ^[&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_FORMAT = %H%M%S:%Q&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;because timestamp extraction in event log will be turned off.&lt;/P&gt;

&lt;P&gt;any one have idea what I can do for it?&lt;/P&gt;

&lt;P&gt;I will be very appreciate for any guidance.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Sep 2011 11:05:27 GMT</pubDate>
    <dc:creator>kurt28</dc:creator>
    <dc:date>2011-09-28T11:05:27Z</dc:date>
    <item>
      <title>extract time from events but date from modification time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-time-from-events-but-date-from-modification-time/m-p/82942#M17211</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I've read &lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.3/Data/Configuretimestamprecognition"&gt;Precedence rules for timestamp assignment&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;What I want is to extract &lt;STRONG&gt;&lt;EM&gt;time)&lt;/EM&gt;&lt;/STRONG&gt;(hour,minute,second,millisecond) from events but &lt;STRONG&gt;&lt;EM&gt;date&lt;/EM&gt;&lt;/STRONG&gt;(month,day,year) from &lt;STRONG&gt;modification time&lt;/STRONG&gt;, because my log is like this : &lt;/P&gt;

&lt;P&gt;[073242:123] xxx xxx xxx ...&lt;/P&gt;

&lt;P&gt;which:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;07&lt;/STRONG&gt; is for &lt;STRONG&gt;hour&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;32&lt;/STRONG&gt; is for &lt;STRONG&gt;minute&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;42&lt;/STRONG&gt; is for &lt;STRONG&gt;second&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;123&lt;/STRONG&gt; is for &lt;STRONG&gt;millisecond&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;and I need to get &lt;STRONG&gt;&lt;EM&gt;date&lt;/EM&gt;&lt;/STRONG&gt; from &lt;STRONG&gt;modification time&lt;/STRONG&gt; because I don't have date info in the events and the log file is created daily.&lt;/P&gt;

&lt;P&gt;According to &lt;A href="http://docs.splunk.com/Documentation/Splunk/4.2.3/Data/Configuretimestamprecognition"&gt;Precedence rules for timestamp assignment&lt;/A&gt;,&lt;/P&gt;

&lt;P&gt;I try to set &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_PREFIX = ^[&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_FORMAT = %H%M%S:%Q&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;in props.conf and I get the right &lt;STRONG&gt;&lt;EM&gt;time&lt;/EM&gt;&lt;/STRONG&gt; but wrong &lt;STRONG&gt;&lt;EM&gt;date&lt;/EM&gt;&lt;/STRONG&gt;(splunk gets the system date for me)&lt;/P&gt;

&lt;P&gt;Besides, theoretically I can let &lt;STRONG&gt;modification time&lt;/STRONG&gt; extracted for my event date by setting &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;DATETIME_CONFIG = NONE&lt;/STRONG&gt; in props.conf, but it failed. I still get &lt;STRONG&gt;&lt;EM&gt;time&lt;/EM&gt;&lt;/STRONG&gt; that the log be indexed.&lt;/P&gt;

&lt;P&gt;And even &lt;STRONG&gt;DATETIME_CONFIG = NONE&lt;/STRONG&gt; works for my event date it will fail on &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_PREFIX = ^[&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;TIME_FORMAT = %H%M%S:%Q&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;because timestamp extraction in event log will be turned off.&lt;/P&gt;

&lt;P&gt;any one have idea what I can do for it?&lt;/P&gt;

&lt;P&gt;I will be very appreciate for any guidance.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2011 11:05:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-time-from-events-but-date-from-modification-time/m-p/82942#M17211</guid>
      <dc:creator>kurt28</dc:creator>
      <dc:date>2011-09-28T11:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: extract time from events but date from modification time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/extract-time-from-events-but-date-from-modification-time/m-p/82943#M17212</link>
      <description>&lt;P&gt;The closest that you can get is to encode the date in the &lt;EM&gt;filename&lt;/EM&gt; as a literal string.  Once you do this (you can use a non-splunk custom pre-parser script to do this if you have to), then you can use &lt;CODE&gt;datetime.xml&lt;/CODE&gt; to pull the &lt;CODE&gt;date&lt;/CODE&gt; from the &lt;CODE&gt;filename&lt;/CODE&gt; but the &lt;CODE&gt;time&lt;/CODE&gt; from each &lt;CODE&gt;event&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;datetime&amp;gt;
&amp;lt;!--EACH FILENAME HAS THE FOLLOWING FORMAT:
"*-YYMMDD-hh_mm" Where
"YY" is a two digit number representing the year.
"MM" is a two digit number representing the month.
"DD" is a two digit number representing the day of the month.
"hh" is a two digit number representing the hour of the day (24 hour).
"mm" is a two digit number representing the number of minutes after the hour.--&amp;gt;
&amp;lt;define name="datefromfile" extract="year, month, day"&amp;gt;
   &amp;lt;text&amp;gt;&amp;lt;![CDATA[source::.*?-(\d{2})(\d{2})(\d{2}]]&amp;gt;-&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;!--EACH EVENT HAS THE FOLLOWING FORMAT:
#Position|Description
#   1-2  |Time of day-hours
#   3-4  |Time of day-minutes
#   5-6  |Time of day-seconds
&amp;lt;define name="timefromevents" extract="hour, minute,second"&amp;gt;
    &amp;lt;text&amp;gt;&amp;lt;![CDATA[^(\d{2})(\d{2})(\d{2})]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;timePatterns&amp;gt;
   &amp;lt;use name="timefromevents"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;
&amp;lt;datePatterns&amp;gt;
   &amp;lt;use name="datefromfile"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;
&amp;lt;/datetime&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2015 21:14:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/extract-time-from-events-but-date-from-modification-time/m-p/82943#M17212</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-29T21:14:26Z</dc:date>
    </item>
  </channel>
</rss>

