<?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: Two timestamps, trying to index based on the second with TIME_PREFIX in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18520#M2537</link>
    <description>&lt;P&gt;I don't think that you need to include the space and double quote. TIME_PREFIX tells Splunk to look after the pattern for a time stamp. &lt;/P&gt;

&lt;P&gt;I think the problem here is probably 2 fold.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;you should include the space between the date and time, I don't know how Splunk would behave when you've got a literal space in a regex within props.conf.&lt;/P&gt;

&lt;P&gt;TIME_PREFIX = 20\d{2}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{3}&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;TIME_PREFIX should be used with TIME_FORMAT, which doesn't appear to have been specified. I would suggest that you provide instructions for TIME_FORMAT as well(the space below is fine, in case you're wondering). &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;TIME_FORMAT = %d/%b/%Y:%H:%M:%S %z&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Additionally, I would recommend using MAX_TIMESTAMP_LOOKAHEAD to prevent splunk from looking beyond the time stamp boundaries. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD = 27
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, to put it together:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ironport]
SHOULD_LINEMERGE = False
SEDCMD-10 = s/^\#.*//
TIME_PREFIX = 20\d{2}\-\d{2}\-\d{2}\s+\d{2}\:\d{2}\:\d{3}
TIME_FORMAT = %d/%b/%Y:%H:%M:%S %z
MAX_TIMESTAMP_LOOKAHEAD = 27
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Sep 2020 11:37:24 GMT</pubDate>
    <dc:creator>jbsplunk</dc:creator>
    <dc:date>2020-09-28T11:37:24Z</dc:date>
    <item>
      <title>Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18515#M2532</link>
      <description>&lt;P&gt;I have logs with two timestamps, one in UTC, one in local. I'm trying to index based on the second, because the first is buggy. I'm trying to use TIME_PREFIX to do this, but I can't get it to work for me.&lt;/P&gt;

&lt;P&gt;I've tested the &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt; string several ways to ensure that it matches. I've used command line grep, regex in the splunk search, and rex in the splunk search, and they all find the string. Additionally, if I manually cut the first time stamp out, Splunk recognizes and translates the other timestamp correctly. However, using TIME_PREFIX, the time always gets set to the time of ingest.&lt;/P&gt;

&lt;P&gt;Example log line:&lt;BR /&gt;
(Notice that what should be UTC time is in error. Wrong time zone and seconds field incorrect.)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2012-03-15 10:05:130 "15/Mar/2012:10:05:05 -0400" 192.XXX.XXX.XXX GET &lt;A href="http://www.google.com/" target="test_blank"&gt;http://www.google.com/&lt;/A&gt; 74.125.91.103 80 TCP_MISS 200 - - 34337 text/html 34176 DIRECT - - 50
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;indexes.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[proxy]
coldPath = $SPLUNK_DB/proxy/colddb
homePath = $SPLUNK_DB/proxy/db
thawedPath = $SPLUNK_DB/proxy/thaweddb
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;inputs.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[batch:///var/log/proxy]
disabled = false
move_policy = sinkhole
host = ironport
index = proxy
sourcetype = ironport
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ironport]
SHOULD_LINEMERGE = False
SEDCMD-10 = s/^\#.*//
TIME_PREFIX="^20\d{2}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d+"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2012 15:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18515#M2532</guid>
      <dc:creator>supersleepwalke</dc:creator>
      <dc:date>2012-04-04T15:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18516#M2533</link>
      <description>&lt;OL&gt;
&lt;LI&gt;your raw data has wrong $TZ so Splunk doesnt know any different unless you tell it this source has specific $TZ.&lt;/LI&gt;
&lt;LI&gt;i used your raw data above, i then create a new source, preview the source, adjust the timestamp, i use quotes " as the preface and it highlights the 2nd timestamp including the -0400, and then you can choose UTC for TZ, etc. your 1st time "130" looks like ms and not sec. is this format a option from your ironport web appliance? i dont get that format from my ESA's using syslog.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 04 Apr 2012 16:13:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18516#M2533</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2012-04-04T16:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18517#M2534</link>
      <description>&lt;P&gt;then props.conf shows (in GUI, etc)&lt;/P&gt;

&lt;P&gt;# your settings&lt;BR /&gt;
MAX_TIMESTAMP_LOOKAHEAD=50&lt;BR /&gt;
NO_BINARY_CHECK=1&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
TIME_PREFIX="&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:37:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18517#M2534</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2020-09-28T11:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18518#M2535</link>
      <description>&lt;P&gt;I think you might have to include the two extra characters preceeding the second timestamp: the space and the double quote. And remove the leading double quote in the regex. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_PREFIX= ^20\d{2}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d+\s"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 17:29:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18518#M2535</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-04-04T17:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18519#M2536</link>
      <description>&lt;P&gt;i just used " and it finds the whole 2nd timestamp&lt;BR /&gt;
there's only one " prefacing the timestamp so i dont see any need to define all of the preface, plus its probably faster just using "&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 18:09:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18519#M2536</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2012-04-04T18:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18520#M2537</link>
      <description>&lt;P&gt;I don't think that you need to include the space and double quote. TIME_PREFIX tells Splunk to look after the pattern for a time stamp. &lt;/P&gt;

&lt;P&gt;I think the problem here is probably 2 fold.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;you should include the space between the date and time, I don't know how Splunk would behave when you've got a literal space in a regex within props.conf.&lt;/P&gt;

&lt;P&gt;TIME_PREFIX = 20\d{2}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{3}&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;TIME_PREFIX should be used with TIME_FORMAT, which doesn't appear to have been specified. I would suggest that you provide instructions for TIME_FORMAT as well(the space below is fine, in case you're wondering). &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;TIME_FORMAT = %d/%b/%Y:%H:%M:%S %z&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Additionally, I would recommend using MAX_TIMESTAMP_LOOKAHEAD to prevent splunk from looking beyond the time stamp boundaries. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD = 27
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, to put it together:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ironport]
SHOULD_LINEMERGE = False
SEDCMD-10 = s/^\#.*//
TIME_PREFIX = 20\d{2}\-\d{2}\-\d{2}\s+\d{2}\:\d{2}\:\d{3}
TIME_FORMAT = %d/%b/%Y:%H:%M:%S %z
MAX_TIMESTAMP_LOOKAHEAD = 27
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:37:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18520#M2537</guid>
      <dc:creator>jbsplunk</dc:creator>
      <dc:date>2020-09-28T11:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18521#M2538</link>
      <description>&lt;P&gt;Solved.&lt;/P&gt;

&lt;P&gt;The problem is my quotes in the TIME_PREFIX. Here's the correct string:&lt;/P&gt;

&lt;P&gt;TIME_PREFIX=^20\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d+&lt;/P&gt;

&lt;P&gt;The quotes are taken literally on that string. There are no quotes in what I'm trying to ignore. I just quoted the regex without thinking about it, since that's what I'm used to in the splunk web interface.&lt;/P&gt;

&lt;P&gt;FYI, to answer your other questions:&lt;/P&gt;

&lt;P&gt;The "130" is a bug, verified with the vendor.&lt;/P&gt;

&lt;P&gt;The second time stamp is accurate, in local time, with TZ indicated. The first time stamp is incorrect, which is why I'm trying to skip it.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 21:32:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18521#M2538</guid>
      <dc:creator>supersleepwalke</dc:creator>
      <dc:date>2012-04-04T21:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18522#M2539</link>
      <description>&lt;P&gt;Solved.&lt;/P&gt;

&lt;P&gt;The problem is my quotes in the TIME_PREFIX. Here's the correct string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_PREFIX=^20d{2}-d{2}-d{2} d{2}:d{2}:d+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The quotes are taken literally on that string. There are no quotes in what I'm trying to ignore. I just quoted the regex without thinking about it, since that's what I'm used to in the splunk web interface.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 21:33:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18522#M2539</guid>
      <dc:creator>supersleepwalke</dc:creator>
      <dc:date>2012-04-04T21:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18523#M2540</link>
      <description>&lt;P&gt;Once I get Splunk to ignore the bad timestamp at the beginning, it recognizes the second timestamp out-of-the-box. No TIME_FORMAT configuration is necesary.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 21:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18523#M2540</guid>
      <dc:creator>supersleepwalke</dc:creator>
      <dc:date>2012-04-04T21:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18524#M2541</link>
      <description>&lt;P&gt;Time format does improve performance, so even if you don't need it, it won't hurt to have it in place. Glad to hear you got things working &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 21:49:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18524#M2541</guid>
      <dc:creator>jbsplunk</dc:creator>
      <dc:date>2012-04-04T21:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Two timestamps, trying to index based on the second with TIME_PREFIX</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18525#M2542</link>
      <description>&lt;P&gt;wow, if you post the data pls post the real data (sanitize is ok) but dont add chars.&lt;BR /&gt;
the regex you have is way too long, shorten preface to&lt;BR /&gt;
\d{3}\s+&lt;BR /&gt;
simpler is faster&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 00:30:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Two-timestamps-trying-to-index-based-on-the-second-with-TIME/m-p/18525#M2542</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2012-04-05T00:30:21Z</dc:date>
    </item>
  </channel>
</rss>

