<?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: Garbage collection logs field extraction from log file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326864#M97400</link>
    <description>&lt;P&gt;As stated before, please make sure you use &lt;CODE&gt;code button (101010)&lt;/CODE&gt; in Splunk Answers for code you do not want characters to escape. Your regex is missing field names.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2017 08:34:07 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-09-13T08:34:07Z</dc:date>
    <item>
      <title>Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326848#M97384</link>
      <description>&lt;P&gt;Would like to extract fields from the below log by using reqular expressions. Can some one help me&lt;/P&gt;

&lt;P&gt;28820.220: [Full GC (System.gc())  8832K-&amp;gt;8624K(37888K), 0.0261704 secs]&lt;BR /&gt;
29372.500: [GC (Allocation Failure)  23984K-&amp;gt;8816K(37888K), 0.0013546 secs]&lt;BR /&gt;
29932.500: [GC (Allocation Failure)  24176K-&amp;gt;8808K(37888K), 0.0017082 secs]&lt;BR /&gt;
30492.500: [GC (Allocation Failure)  24168K-&amp;gt;8960K(37888K), 0.0017122 secs]&lt;BR /&gt;
31047.500: [GC (Allocation Failure)  24320K-&amp;gt;8944K(37888K), 0.0020634 secs]&lt;BR /&gt;
31602.500: [GC (Allocation Failure)  24304K-&amp;gt;8992K(37888K), 0.0017542 secs]&lt;BR /&gt;
32157.500: [GC (Allocation Failure)  24352K-&amp;gt;8968K(37888K), 0.0018971 secs]&lt;BR /&gt;
32420.247: [GC (System.gc())  16160K-&amp;gt;8944K(37888K), 0.0012816 secs]&lt;BR /&gt;
32420.248: [Full GC (System.gc())  8944K-&amp;gt;8624K(37888K), 0.0205035 secs]&lt;/P&gt;

&lt;P&gt;Would like to extract Full GC ---   8944K-&amp;gt;8624K(37888K)&lt;/P&gt;

&lt;P&gt;Field1: 8944 --- what ever comes throughout the multiple entries of Full GC&lt;BR /&gt;
Field2:  8624  -- what ever comes throughout the multiple entries of Full GC&lt;BR /&gt;
Field3:  37888  -- what ever comes throughout the multiple entries of Full GC&lt;/P&gt;

&lt;P&gt;similarly for GC&lt;/P&gt;

&lt;P&gt;Early help would be appreciate as my organization not allowing me to install field extractor app to extract easily these fields&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 08:56:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326848#M97384</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-08T08:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326849#M97385</link>
      <description>&lt;P&gt;Hi nagaraju_chittathuru,&lt;BR /&gt;
try this regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\[Full GC.*\)\)\s(?&amp;lt;FullGC1&amp;gt;[^K]*)K-\&amp;gt;(?&amp;lt;FullGC2&amp;gt;[^K]*)K\((?&amp;lt;FullGC3&amp;gt;[^\)]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if instead of K you could have M or G, you can use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\[Full GC.*\)\)\s(?&amp;lt;FullGC1&amp;gt;[^KMG]*)(K|M|G)-\&amp;gt;(?&amp;lt;FullGC2&amp;gt;[^KMG]*)(K|M|G)\((?&amp;lt;FullGC3&amp;gt;[^KMG]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Test it at &lt;A href="https://regex101.com/r/z3PqFP/1"&gt;https://regex101.com/r/z3PqFP/1&lt;/A&gt;&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 09:33:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326849#M97385</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-08T09:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326850#M97386</link>
      <description>&lt;P&gt;@nagaraju_chittathuru, based on the sample events provided please try the following rex command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| rex field=_raw "\[([^\(]+)\(([^\)]+)\)[\)|\s]+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\)"
| table field1, field2, field3, _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use regex101.com for writing/testing your regular expressions. Also Splunk has its own &lt;CODE&gt;Interactive Field Extraction (IFX)&lt;/CODE&gt; that you can use for Splunk to come up with required Regular Expression. &lt;BR /&gt;
Link to documentation: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 09:36:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326850#M97386</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-08T09:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326851#M97387</link>
      <description>&lt;P&gt;Hi cusello,&lt;BR /&gt;
Thanks for quick turnaoround...when I build the query &lt;/P&gt;

&lt;P&gt;mysearch | rex field=_raw "[Full GC.&lt;EM&gt;))\s(?[^KMG]&lt;/EM&gt;)(K|M|G)-&amp;gt;(?[^KMG]&lt;EM&gt;)(K|M|G)((?[^KMG]&lt;/EM&gt;)" | table FullGC1, FullGC2, FullGC3, _raw&lt;/P&gt;

&lt;P&gt;this is returning only the first Full GC event eventhough I have multiple Full GC in the same event.&lt;BR /&gt;
in &lt;A href="https://regex101.com/r/z3PqFP/1"&gt;https://regex101.com/r/z3PqFP/1&lt;/A&gt; it is showing the other occurences..but when I build the actual query only one row it is printing&lt;BR /&gt;
Any sort of help would be appreciated? &lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 16:54:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326851#M97387</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-08T16:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326852#M97388</link>
      <description>&lt;P&gt;Hi niketnilay,&lt;BR /&gt;
Thanks for quick turnaoround...when I build the query &lt;/P&gt;

&lt;P&gt;mysearch | | rex field=_raw "[([^(]+)(([^)]+))[)|\s]+(?\d+)K-&amp;gt;(?\d+)K((?\d+)K)"&lt;BR /&gt;
| table field1, field2, field3, _raw&lt;/P&gt;

&lt;P&gt;this is returning only the first Full GC event eventhough  I have multiple Full GC in the same event.Any sort of help would be appreciated?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 16:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326852#M97388</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-08T16:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326853#M97389</link>
      <description>&lt;P&gt;In case you have multiple matches in the same event you can use &lt;CODE&gt;max_match&lt;/CODE&gt; argument. If set to 0 it will try to find all matches&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "\[([^\(]+)\(([^\)]+)\)[\)|\s]+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\)" max_match=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Sep 2017 18:00:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326853#M97389</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-08T18:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326854#M97390</link>
      <description>&lt;P&gt;Hi nagaraju_chittathuru,&lt;BR /&gt;
try to add &lt;CODE&gt;max_match=0&lt;/CODE&gt; to the rex command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch 
| rex max_match=0 "[Full GC.))\s(?[^KMG])(K|M|G)-\&amp;gt;(?[^KMG])(K|M|G)((?[^KMG])" 
| table FullGC1, FullGC2, FullGC3, _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:41:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326854#M97390</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T15:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326855#M97391</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval _raw="28820.220: [Full GC (System.gc()) 8832K-&amp;gt;8624K(37888K), 0.0261704 secs]
29372.500: [GC (Allocation Failure) 23984K-&amp;gt;8816K(37888K), 0.0013546 secs]
29932.500: [GC (Allocation Failure) 24176K-&amp;gt;8808K(37888K), 0.0017082 secs]
30492.500: [GC (Allocation Failure) 24168K-&amp;gt;8960K(37888K), 0.0017122 secs]
31047.500: [GC (Allocation Failure) 24320K-&amp;gt;8944K(37888K), 0.0020634 secs]
31602.500: [GC (Allocation Failure) 24304K-&amp;gt;8992K(37888K), 0.0017542 secs]
32157.500: [GC (Allocation Failure) 24352K-&amp;gt;8968K(37888K), 0.0018971 secs]
32420.247: [GC (System.gc()) 16160K-&amp;gt;8944K(37888K), 0.0012816 secs]
32420.248: [Full GC (System.gc()) 8944K-&amp;gt;8624K(37888K), 0.0205035 secs]"

| rename COMMENT AS "Everything above generates a sample event; everything below is your solution"

| rex max_match=0 "(?ms)\d+\.\d+\D+(?&amp;lt;Field1&amp;gt;[^-\r\n\.]+)-&amp;gt;(?&amp;lt;Field2&amp;gt;[^\(]+)\((?&amp;lt;Field3&amp;gt;[^\)]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Sep 2017 22:29:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326855#M97391</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-09-09T22:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326856#M97392</link>
      <description>&lt;P&gt;I am trying to extend the the regex to extract the first time stamp by using the below&lt;BR /&gt;
\s\w+.(?\w+:)..somehow it is extracting only after the decimal.&lt;BR /&gt;
from the below example.could you pls help in this regard&lt;BR /&gt;
&lt;STRONG&gt;29372.500:&lt;/STRONG&gt; [GC (Allocation Failure) 23984K-&amp;gt;8816K(37888K), 0.0013546 secs]&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 13:46:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326856#M97392</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-11T13:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326857#M97393</link>
      <description>&lt;P&gt;Try the following regular expression which extracts timestamp before colon sign i.e. &lt;CODE&gt;29372.500&lt;/CODE&gt; etc as &lt;CODE&gt;timestamp&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?&amp;lt;timestamp&amp;gt;[^:]+):\s+\[([^\(]+)\(([^\)]+)\)[\)|\s]+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please make sure you use &lt;CODE&gt;code button (101010)&lt;/CODE&gt; on Splunk Answers while posting code so that special characters do not escape. Also as stated earlier test out your Regular Expression on regex101.com with your actual sample data.&lt;/P&gt;

&lt;P&gt;Please check and confirm.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 14:05:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326857#M97393</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-11T14:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326858#M97394</link>
      <description>&lt;P&gt;Hi niketnilay,&lt;BR /&gt;
Thanks for quick turnaround. Below is the example data&lt;BR /&gt;
28820.220: [Full GC (System.gc()) 8832K-&amp;gt;8624K(37888K), 0.0261704 secs]&lt;BR /&gt;
29372.500: [GC (Allocation Failure) 23984K-&amp;gt;8816K(37888K), 0.0013546 secs]&lt;/P&gt;

&lt;P&gt;out of this trying to extract the &lt;BR /&gt;
28820.220 as "timestamp"&lt;BR /&gt;
0.0261704 as "gctime"&lt;BR /&gt;
8832k as "field1"&lt;BR /&gt;
8624K as "field2"&lt;BR /&gt;
37888K as "field3"&lt;/P&gt;

&lt;P&gt;below is the final regex that I worked ...but for some events it is failing.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex max_match=0 field=_raw "^(?&amp;lt;timestamp&amp;gt;[^:]+):\s+\[([^\(]+)\(([^\)]+)\)[\)|\s]+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\)\,+\s\w\.(?&amp;lt;gctime&amp;gt;\w+)\s" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;looks like my "gctime" regex causing the issue...to get the value 0.0261704 do I need to tweak the regex ?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 17:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326858#M97394</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-11T17:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326859#M97395</link>
      <description>&lt;P&gt;Please try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?&amp;lt;timestamp&amp;gt;[^:]+):\s+\[([^\(]+)\(([^\)]+)\)[\)|\s]+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\),\s+(?&amp;lt;gctime&amp;gt;[^\s]+)\ssecs\]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You must try to grasp how regular expressions work in order to grasp and exploit its potential. As stated earlier, regex101.com is also a resource for quickly learning what the regex means. &lt;CODE&gt;QUICK REFRENECE&lt;/CODE&gt; is available on bottom right.&lt;BR /&gt;
You can also refer to Regular Expressions in Splunk Docs: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/AboutSplunkregularexpressions"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/AboutSplunkregularexpressions&lt;/A&gt;&lt;BR /&gt;
Please check and confirm.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 19:21:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326859#M97395</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-11T19:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326860#M97396</link>
      <description>&lt;P&gt;Hi cusello,&lt;BR /&gt;
Thanks a lot that works fine. Would like to extend the regex for the timestamp and gctime from the sample data below&lt;/P&gt;

&lt;P&gt;28820.220: [Full GC (System.gc()) 8832K-&amp;gt;8624K(37888K), 0.0261704 secs]&lt;BR /&gt;
29372.500: [GC (Allocation Failure) 23984K-&amp;gt;8816K(37888K), 0.0013546 secs]&lt;/P&gt;

&lt;P&gt;out of this trying to extract the below fields ...could you help me around&lt;BR /&gt;
28820.220 as "timestamp"&lt;BR /&gt;
0.0261704 as "gctime"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; mysearch 
 | rex max_match=0 "[Full GC.))\s(?[^KMG])(K|M|G)-\&amp;gt;(?[^KMG])(K|M|G)((?[^KMG])" 
 | table FullGC1, FullGC2, FullGC3, _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Sep 2017 14:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326860#M97396</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-12T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326861#M97397</link>
      <description>&lt;P&gt;@nagaraju_chittathuru, have you tried above regex? This should extract &lt;CODE&gt;gctime&lt;/CODE&gt; as well.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 16:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326861#M97397</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-12T16:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326862#M97398</link>
      <description>&lt;P&gt;try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?&amp;lt;timestamp&amp;gt;[^:]*): \[Full GC.*\)\)\s(?&amp;lt;FullGC1&amp;gt;[^K]*)K-\&amp;gt;(?&amp;lt;FullGC2&amp;gt;[^K]*)K\((?&amp;lt;FullGC3&amp;gt;[^\)]*)\),\s+(?&amp;lt;gctime&amp;gt;[^ ]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;BR /&gt;
(if you're satisfied accept or upvote it)&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:26:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326862#M97398</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-12T17:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326863#M97399</link>
      <description>&lt;P&gt;Hi niketnilay,&lt;BR /&gt;
Below is the example data&lt;BR /&gt;
28820.220: [Full GC (System.gc()) 8832K-&amp;gt;8624K(37888K), 0.0261704 secs]&lt;BR /&gt;
29372.500: [GC (Allocation Failure) 23984K-&amp;gt;8816K(37888K), 0.0013546 secs]&lt;/P&gt;

&lt;P&gt;out of this trying to extract only for "Full GC"&lt;BR /&gt;
28820.220 as "timestamp"&lt;BR /&gt;
0.0261704 as "gctime"&lt;BR /&gt;
8832k as "field1"&lt;BR /&gt;
8624K as "field2"&lt;BR /&gt;
37888K as "field3"&lt;BR /&gt;
below is the final regex that I worked with out timestamp this is pulling correct "Full GC" events and if I add timestamp it is pulling all Full GC as well as GC logs where I only need Full GC logs along with its timestamp&lt;BR /&gt;
    "^(?&lt;TIMESTAMP&gt;[^:]+):\s+[Full GC([^(]+)(([^)]+))[)|\s]+(?&lt;FIELD1&gt;\d+)K-&amp;gt;(?&lt;FIELD2&gt;\d+)K((?&lt;FIELD3&gt;\d+)K),\s+(?&lt;GCTIME&gt;[^\s]+)\ssecs]"&lt;/GCTIME&gt;&lt;/FIELD3&gt;&lt;/FIELD2&gt;&lt;/FIELD1&gt;&lt;/TIMESTAMP&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 07:46:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326863#M97399</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-13T07:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326864#M97400</link>
      <description>&lt;P&gt;As stated before, please make sure you use &lt;CODE&gt;code button (101010)&lt;/CODE&gt; in Splunk Answers for code you do not want characters to escape. Your regex is missing field names.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 08:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326864#M97400</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-13T08:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326865#M97401</link>
      <description>&lt;P&gt;Following is the run anywhere search which works for your mock data using the same regular expression I had previously provided:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="28820.220: [Full GC (System.gc()) 8832K-&amp;gt;8624K(37888K), 0.0261704 secs]
29372.500: [GC (Allocation Failure) 23984K-&amp;gt;8816K(37888K), 0.0013546 secs]"
| rex max_match=0 field=_raw "^(?&amp;lt;timestamp&amp;gt;[^:]+):\s+\[([^\(]+)\(([^\)]+)\)[\)|\s]+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\),\s+(?&amp;lt;gctime&amp;gt;[^\s]+)\ssecs\]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you are testing the regular expression on regex101.com you need to turn on &lt;CODE&gt;multi line&lt;/CODE&gt; regex flag so that two events match the same regex. Or else paste only one event for testing at a time. Following is a screenshot from regex101.com confirming theregular expression is working fine:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://wiki.splunk.com/images/a/a6/Regex_example.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 08:48:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326865#M97401</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-13T08:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326866#M97402</link>
      <description>&lt;P&gt;this is what the issue...the regex is pulling all the events for "Full GC" and "GC"....where I am interested in only for "Full GC".&lt;BR /&gt;
If I exclude timestamp and gctime query works fine and if include the timestamp and gctime will not pick.&lt;BR /&gt;
Here is the regex I tried and I have modified for Full GC&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"^(?&amp;lt;timestamp&amp;gt;[^:]+):\s+\[Full GC([^\(]+)\(([^\)]+)\)[\)|\s]+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\),\s+(?&amp;lt;gctime&amp;gt;[^\s]+)\ssecs\]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Sep 2017 10:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326866#M97402</guid>
      <dc:creator>nagaraju_chitta</dc:creator>
      <dc:date>2017-09-13T10:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Garbage collection logs field extraction from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326867#M97403</link>
      <description>&lt;P&gt;Try this if you are only interested in Full GC (It will ignore the events with GC)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"^(?&amp;lt;timestamp&amp;gt;[^:]+):\s+\[Full GC\s\(([^\)]+)\)\)\s+(?&amp;lt;field1&amp;gt;\d+)K-\&amp;gt;(?&amp;lt;field2&amp;gt;\d+)K\((?&amp;lt;field3&amp;gt;\d+)K\),\s+(?&amp;lt;gctime&amp;gt;[^\s]+)\ssecs\]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Sep 2017 10:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Garbage-collection-logs-field-extraction-from-log-file/m-p/326867#M97403</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-13T10:44:20Z</dc:date>
    </item>
  </channel>
</rss>

