<?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: Timestamp/regex help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268496#M80763</link>
    <description>&lt;P&gt;The following worked fine for me&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE=false
NO_BINARY_CHECK=true
LINE_BREAKER=([\r\n]+)\[\d+\]\[\d+
TIME_PREFIX=^\[\d+\]\[\d+\]\[
TIME_FORMAT=%m/%d/%Y][%H:%M:%S.%N
MAX_TIMESTAMP_LOOKAHEAD=24
 TZ=America/New_York
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The attribute MAX_TIMESTAMP_LOOKAHEAD is basically length of the timestamp value. It how far splunk should look after the TIME_PREFIX  not the how far it is from the start of the event.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 09:15:21 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2020-09-29T09:15:21Z</dc:date>
    <item>
      <title>Timestamp/regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268491#M80758</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm having a hard time getting a regex/timestamp to work properly. &lt;/P&gt;

&lt;P&gt;Here  are some sample events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[5892][9008][03/26/2016][11:00:36.607][][][][CServer::ProcessRequest][CServer.cpp:5901][][Leave function CServer::ProcessRequest][][][][][][][][][712][][][][][]
[5892][9008][03/26/2016][11:00:36.607][][][][CSm_Az_Message::ProcessMessage][Sm_Az_Message.cpp:371][][Leave function CSm_Az_Message::ProcessMessage][][][][][][][][][712][][][][][]
[5892][9008][03/26/2016][11:00:36.607][][][][CSm_Az_Message::IsAuthorized][IsAuthorized.cpp:877][][Leave function CSm_Az_Message::IsAuthorized][][][][][][][][][true][][][][][]
[5892][9008][03/26/2016][11:00:36.607][][][][CSm_Az_Message::SendReply][Sm_Az_Message.cpp:575][][Leave function CSm_Az_Message::SendReply][][][][][][][][][][][][][][]
[5892][9008][03/26/2016][11:00:36.607][default_ei1059vwin][s13435/r6559][][CSm_Az_Message::ProcessMessage][Sm_Az_Message.cpp:571][][** Status: Authorized. ][][][][][][][][][][][][][][]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's my props:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE=false
LINE_BREAKER=([\r\n]+)\[\d+\]\[\d+
NO_BINARY_CHECK=true
disabled=false
TZ=America/New_York
TIME_PREFIX = ^\[\d+\]\[\d+\]\[
TIME_FORMAT=%m/%d/%Y][%H:%M:%S.%3N
MAX_TIMESTAMP_LOOKAHEAD=75
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get an error:  "could not use strptime to parse timestamp...make sure a prefix pattern is specified."&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2016 15:19:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268491#M80758</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2016-03-26T15:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp/regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268492#M80759</link>
      <description>&lt;P&gt;When I wrote these events to file, the auto linebreak and auto timestamp extract worked perfectly fine...any reason you are using a custom line break??&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2016 18:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268492#M80759</guid>
      <dc:creator>mattymo</dc:creator>
      <dc:date>2016-03-26T18:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp/regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268493#M80760</link>
      <description>&lt;P&gt;I expect that this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TZ=America/New_York
TIME_FORMAT=%m/%d/%Y][%H:%M:%S.%3N
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You only need those two lines.  If it doesn't work, try escaping the brackets and let us know.&lt;/P&gt;

&lt;P&gt;Added:&lt;BR /&gt;
If you want to add the other lines, these ones are default and are not required/useful:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE=false
NO_BINARY_CHECK=true
disabled=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For the other lines, I would suggest (the brackets need to be escaped):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LINE_BREAKER=^\[\d+\]\[\d+
TIME_PREFIX =^(\[\d+\]){2}\[
MAX_TIMESTAMP_LOOKAHEAD=75
KV_MODE = none
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Mar 2016 18:22:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268493#M80760</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2016-03-26T18:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp/regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268494#M80761</link>
      <description>&lt;P&gt;We purposely don't use auto linebreaking or auto timestamp, to improve performance.  Every props must have a LINE_BREAK, TIME_STAMP, TIME_PREFIX, KV_MODE, ANNOTATE_PUNCT....   &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268494#M80761</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2020-09-29T09:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp/regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268495#M80762</link>
      <description>&lt;P&gt;Your events are already single line events, so to remove debug of the line breaker, I explicitly set break each line and was able to extract the timestamp with:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Update: added landen99's line breaker suggestion below in case you absolutely have to have it and this props still working for me....&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ splunk_answers_timestamp ]
SHOULD_LINEMERGE = false
NO_BINARY_CHECK = true
BREAK_ONLY_BEFORE = ^\[\d+\]\[\d+
TIME_FORMAT = %m/%d/%Y][%H:%M:%S.%3N
TIME_PREFIX = ^\[\d+\]\[\d+\]\[
TZ = America/New_York
KV_MODE = none
MAX_TIMESTAMP_LOOKAHEAD=75
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think perhaps you were't accounting for what chars would be left after your line breaker and time prefix....also not sure if you escaped everything you needed to...&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2016 20:08:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268495#M80762</guid>
      <dc:creator>n00badmin</dc:creator>
      <dc:date>2016-03-26T20:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp/regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268496#M80763</link>
      <description>&lt;P&gt;The following worked fine for me&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE=false
NO_BINARY_CHECK=true
LINE_BREAKER=([\r\n]+)\[\d+\]\[\d+
TIME_PREFIX=^\[\d+\]\[\d+\]\[
TIME_FORMAT=%m/%d/%Y][%H:%M:%S.%N
MAX_TIMESTAMP_LOOKAHEAD=24
 TZ=America/New_York
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The attribute MAX_TIMESTAMP_LOOKAHEAD is basically length of the timestamp value. It how far splunk should look after the TIME_PREFIX  not the how far it is from the start of the event.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268496#M80763</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T09:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp/regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268497#M80764</link>
      <description>&lt;P&gt;This looks just like mine with a few very small differences.  I think that the big takeaway was escaping the brackets in the regex.  If a good answer already exists, it makes sense to simply add a comment to the answer with any small changes or recommendation.  No need for anyone to read through a dozen answers saying exactly the same thing.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2016 19:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timestamp-regex-help/m-p/268497#M80764</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2016-03-27T19:32:31Z</dc:date>
    </item>
  </channel>
</rss>

