<?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 time stamping problem using TIME_PREFIX in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16808#M88409</link>
    <description>&lt;P&gt;I have events that get written to a log file with the timestamp being included in this format   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;date&amp;gt;7/2/2010 1:13:33 PM&amp;lt;/date&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't want to use a lookahead as the data is far into the event and I don't want to take that performance hit for each event.  The attempts I have made haven't seemed to work.  In the past I have been able to specify a simple regex like &lt;CODE&gt;TIME_PREFIX = .+date=&lt;/CODE&gt; in the stanza in &lt;CODE&gt;props.conf&lt;/CODE&gt;
I'm not sure if this is having more problems because of the &lt;CODE&gt;&amp;gt;&lt;/CODE&gt; character and/or because there is not a space before &lt;CODE&gt;&amp;lt;date&amp;gt;&lt;/CODE&gt; in the event.&lt;/P&gt;

&lt;P&gt;Does anyone have ideas on hos I can properly identify the &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt; that will work?&lt;/P&gt;

&lt;P&gt;We are running Splunk 4.1.0&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Sat, 03 Jul 2010 01:21:18 GMT</pubDate>
    <dc:creator>cpenkert</dc:creator>
    <dc:date>2010-07-03T01:21:18Z</dc:date>
    <item>
      <title>time stamping problem using TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16808#M88409</link>
      <description>&lt;P&gt;I have events that get written to a log file with the timestamp being included in this format   &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;date&amp;gt;7/2/2010 1:13:33 PM&amp;lt;/date&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't want to use a lookahead as the data is far into the event and I don't want to take that performance hit for each event.  The attempts I have made haven't seemed to work.  In the past I have been able to specify a simple regex like &lt;CODE&gt;TIME_PREFIX = .+date=&lt;/CODE&gt; in the stanza in &lt;CODE&gt;props.conf&lt;/CODE&gt;
I'm not sure if this is having more problems because of the &lt;CODE&gt;&amp;gt;&lt;/CODE&gt; character and/or because there is not a space before &lt;CODE&gt;&amp;lt;date&amp;gt;&lt;/CODE&gt; in the event.&lt;/P&gt;

&lt;P&gt;Does anyone have ideas on hos I can properly identify the &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt; that will work?&lt;/P&gt;

&lt;P&gt;We are running Splunk 4.1.0&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2010 01:21:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16808#M88409</guid>
      <dc:creator>cpenkert</dc:creator>
      <dc:date>2010-07-03T01:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: time stamping problem using TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16809#M88410</link>
      <description>&lt;P&gt;What is your exact configuration and what events does Splunk have a problem with?&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2010 01:36:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16809#M88410</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-07-03T01:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: time stamping problem using TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16810#M88411</link>
      <description>&lt;P&gt;I'm not sure what you mean by performance hit because of the lookahead.  No matter what your configuration, if you want splunk to extract do do timestamp recognition, then splunk has to search your event for a timestamp.  (You can disable it, but then the current time will be applied to your events when they are picked up by splunk.)&lt;/P&gt;

&lt;P&gt;Just so you know, your example &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt; started with "&lt;CODE&gt;.+&lt;/CODE&gt;", which is a greedy regular expression which almost guarantees you poorer performance since your instructing the regex engine to look as far as it can into the event, and only once it's exceeded the max lookahead amount (which is the &lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD&lt;/CODE&gt; setting) will it fall back to the first match (and probably the only match).  You could use a lazy expression like "&lt;CODE&gt;.+?&lt;/CODE&gt;", however, you don't really need either since &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt; is a "search" mode regular expression (not "match" mode).  The bottom line is that you really don't want "&lt;CODE&gt;.+&lt;/CODE&gt;" or "&lt;CODE&gt;.+?&lt;/CODE&gt; at the front of your regex.&lt;/P&gt;

&lt;P&gt;This should work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_PREFIX = &amp;lt;date&amp;gt;
TIME_FORMAT = %d/%m/%Y %I:%H:%S %P
MAX_TIMESTAMP_LOOKAHEAD=1000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would do some analysis to see how far into your event the timestamp is really occurring.  If your having timestamp problems now, based on what you said, then I suspect that you may have to actually raise this to a higher value (which is why I raised from the default of 100 to 1000), because splunk should have been able to automatically find the timestamp you mentioned.  Once splunk is finding your timestamp you can figure out how far into the event your timestamps are by using  the following search.  (Then use this value to lower your &lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD&lt;/CODE&gt; to a more reasonable value.)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=your_xml_sourcetype | top timeendpos
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;BTW, if your "" occurs at the beginning of a line, then this would be even faster:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_PREFIX = ^\s*&amp;lt;date&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, once you get your timestamp working, you may need to also need to tweak your event breaking logic (I'm guessing your dealing with multi-line events here)&lt;/P&gt;

&lt;P&gt;Be sure to check out the docs:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://www.splunk.com/base/Documentation/4.1/Admin/Indexmulti-lineevents" rel="nofollow"&gt;Configure linebreaking for multi-line events&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 03 Jul 2010 01:37:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16810#M88411</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-07-03T01:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: time stamping problem using TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16811#M88412</link>
      <description>&lt;P&gt;you don't really need the &lt;CODE&gt;\s*&lt;/CODE&gt; at the end of TIME_PREFIX. Splunk will find the prefix, then start looking after that, regardless of what characters are after the match and before the detected time.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2010 03:13:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16811#M88412</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-07-03T03:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: time stamping problem using TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16812#M88413</link>
      <description>&lt;P&gt;Thanks, that's a great tip.  I've run into that scenario before and I didn't know how that worked, specifically with whitespace.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2010 04:09:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/time-stamping-problem-using-TIME-PREFIX/m-p/16812#M88413</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-07-03T04:09:25Z</dc:date>
    </item>
  </channel>
</rss>

