<?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: Regex Extractions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587788#M204707</link>
    <description>&lt;P&gt;If you use Splunk Web to define sourcetype, this is the prompt about timestamp format: "&lt;SPAN&gt;A string in &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/DateandTimeFunctions#strptime.28X.2CY.29" target="_blank" rel="noopener"&gt;strptime()&lt;/A&gt; format that helps Splunk recognize timestamps." &amp;nbsp;The optional "Timestamp prefix" is not for extracting timestamp, but to confine the time format to match a specific location in case that format is repeated in the event or when the format is so loose it may incidentally match other parts of the event.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In your case, I see that you are trying to interpret strings like "08:59:07,602" into timestamp. &amp;nbsp;The question then is, what do each of 08, 59, 07, and 602 mean? &amp;nbsp;The most common interpretation, when written as "08:59:07,602" would be hour, minute, second, and millisecond; in Splunk time format, that's %H:%M:%S,%3N. &amp;nbsp;Is this what you are looking for? (I do not see anything in the sample data that corresponds to a date. &amp;nbsp;As a result, Splunk will interpret your date as 1970-01-01, the Unix epoch 0.)&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 03:37:12 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-03-07T03:37:12Z</dc:date>
    <item>
      <title>How to extract the time from the following two events (taken from the same log) and build a proper sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587773#M204702</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;This is my very first post here and I need some advice because I've been trying for a couple of hours to extract the time from the following two events (taken from the same log) and build a proper sourcetype, but I couldn't find a solution:&lt;/P&gt;
&lt;P&gt;ABIT Stack Job [DBS: ABITNET] ABIT_Outbound[extern] (not exclusive, scheduler) (818209397) 08:59:07,602 *** Threads: 2&lt;BR /&gt;ExportScheduler [Node &lt;A href="http://127.0.0.1:8080/abitnet]-Thread-18727" target="_blank" rel="noopener"&gt;http://127.0.0.1:8080/abitnet]-Thread-18727&lt;/A&gt; 08:59:07,622 [fmI9CashFlowArch]Export fmI9CashFlowArch wird ausgeführt...&lt;/P&gt;
&lt;P&gt;Using regex101 I've gotten&lt;/P&gt;
&lt;P&gt;.*(?:[^ \n]* )*\s(?&amp;lt;time&amp;gt;\d{2}\:\d{2}\:\d{2}\,\d{3})&lt;/P&gt;
&lt;P&gt;but when I try to define a sourcetype, the parsing breaks with "Failed to parse timestamp". The problem is most likely the fact that the timestamp is at a different position in the two events.&lt;/P&gt;
&lt;P&gt;Do you have any ideas?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 04:03:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587773#M204702</guid>
      <dc:creator>John85</dc:creator>
      <dc:date>2022-03-08T04:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587774#M204703</link>
      <description>&lt;P&gt;Your regex appear to work - what have you set for your timestamp lookahead?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 23:16:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587774#M204703</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-03-06T23:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587788#M204707</link>
      <description>&lt;P&gt;If you use Splunk Web to define sourcetype, this is the prompt about timestamp format: "&lt;SPAN&gt;A string in &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/DateandTimeFunctions#strptime.28X.2CY.29" target="_blank" rel="noopener"&gt;strptime()&lt;/A&gt; format that helps Splunk recognize timestamps." &amp;nbsp;The optional "Timestamp prefix" is not for extracting timestamp, but to confine the time format to match a specific location in case that format is repeated in the event or when the format is so loose it may incidentally match other parts of the event.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In your case, I see that you are trying to interpret strings like "08:59:07,602" into timestamp. &amp;nbsp;The question then is, what do each of 08, 59, 07, and 602 mean? &amp;nbsp;The most common interpretation, when written as "08:59:07,602" would be hour, minute, second, and millisecond; in Splunk time format, that's %H:%M:%S,%3N. &amp;nbsp;Is this what you are looking for? (I do not see anything in the sample data that corresponds to a date. &amp;nbsp;As a result, Splunk will interpret your date as 1970-01-01, the Unix epoch 0.)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 03:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587788#M204707</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-03-07T03:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587804#M204715</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thank you for the reply. I don't use Splunk Web to define the sourcetype, I create it manually. I also define (when I write the props manually) the timestamp format (in this case %H:%M:%S,%3N as you mentioned) and also the prefix (which in this case I consider it to be \s ). I also use the LOOKAHEAD param but without any success. But given the fact that my timestamp is at two different points in the two events which can be found in the same log, Splunk isn't able to extract properly the time, I suspect because the regex I use to identify what is in front of the timestamp, is not OK and it does not help Splunk. If I don't enter the time format it's able to identify the time but when I input the format, the parsing breaks with the mentioned error.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 08:01:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587804#M204715</guid>
      <dc:creator>John85</dc:creator>
      <dc:date>2022-03-07T08:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587810#M204717</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;If I use&amp;nbsp;MAX_TIMESTAMP_LOOKAHEAD=98, SPlunk only identifies the date from the "ExportScheduler...." line,&amp;nbsp; normally since I consider the \s&amp;nbsp; as the TIME_PREFIX, the lookahead shoud only be 12 ( the lenght of the time from the event ) but this doesn't work.&lt;/P&gt;&lt;P&gt;The full sourcetype is:&lt;/P&gt;&lt;P&gt;[&amp;lt;SOURCETYPE NAME&amp;gt;]&lt;BR /&gt;CHARSET=UTF-8&lt;BR /&gt;LINE_BREAKER=([\r\n]+).*(?:[^ \n]* )*\s(?&amp;lt;time&amp;gt;\d{2}\:\d{2}\:\d{2}\,\d{3})&lt;BR /&gt;MAX_TIMESTAMP_LOOKAHEAD=98&lt;BR /&gt;NO_BINARY_CHECK=true&lt;BR /&gt;SHOULD_LINEMERGE=true&lt;BR /&gt;category=Custom&lt;BR /&gt;disabled=false&lt;BR /&gt;pulldown_type=true&lt;BR /&gt;TIME_PREFIX=\s&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 08:45:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587810#M204717</guid>
      <dc:creator>John85</dc:creator>
      <dc:date>2022-03-07T08:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587811#M204718</link>
      <description>&lt;P&gt;Try setting your TIME_PREFIX to something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TIME_PREFIX=(\d+\)|Thread\-\d+)\s&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:36:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587811#M204718</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-03-07T09:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587814#M204719</link>
      <description>&lt;P&gt;Thank you, that solution worked, it didn't cross my mind to use a conditional statement in the prefix.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-time-from-the-following-two-events-taken-from/m-p/587814#M204719</guid>
      <dc:creator>John85</dc:creator>
      <dc:date>2022-03-07T09:46:01Z</dc:date>
    </item>
  </channel>
</rss>

