<?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 Varying Field Extractions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66811#M16655</link>
    <description>&lt;P&gt;A sample sequence of my log goes something like this&lt;/P&gt;

&lt;P&gt;07/03/2011 15:26,07/03/2011 15:26,...,... Refresh Process is starting up,CLOSED,UNKNOWN,Smarts-Appmon,0,,,,etcetc&lt;BR /&gt;&lt;BR /&gt;
OR&lt;BR /&gt;&lt;BR /&gt;
07/03/2011 15:06,07/03/2011 15:06,...,... Monitor ...,CLOSED,WARNING,Appmon,0,etcetc&lt;BR /&gt;
OR&lt;BR /&gt;&lt;BR /&gt;
07/03/2011 14:55,07/03/2011 14:55,...,..,...,CLOSED,NORMAL,SNMP,0,etcetc&lt;/P&gt;

&lt;P&gt;so.. im trying to extract the [warning] &lt;BR /&gt;
which varies from "Warning","Normal","Major","Minor","Critical","Unknown"&lt;/P&gt;

&lt;P&gt;however Web extraction gives me: "(?i),CLOSED,(?P&lt;FIELDNAME&gt;[^,]+)"&lt;BR /&gt;
but the field before it could be "OPEN" as well. I tried to add a CLOSED|OPEN but it became an error. can someone enlighten me?&lt;/FIELDNAME&gt;&lt;/P&gt;

&lt;P&gt;another field im having trouble is [source]&lt;BR /&gt;
the regex was based on the number of commas, however, from the 2 examples i given, this is not necessarily true as well. they vary from 5(1st and 2nd) to 6 (3rd log). this problem is similar to my first question. &lt;/P&gt;

&lt;P&gt;Thanks for taking your time to read!&lt;/P&gt;</description>
    <pubDate>Mon, 04 Jun 2012 07:15:52 GMT</pubDate>
    <dc:creator>attgjh1</dc:creator>
    <dc:date>2012-06-04T07:15:52Z</dc:date>
    <item>
      <title>Varying Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66811#M16655</link>
      <description>&lt;P&gt;A sample sequence of my log goes something like this&lt;/P&gt;

&lt;P&gt;07/03/2011 15:26,07/03/2011 15:26,...,... Refresh Process is starting up,CLOSED,UNKNOWN,Smarts-Appmon,0,,,,etcetc&lt;BR /&gt;&lt;BR /&gt;
OR&lt;BR /&gt;&lt;BR /&gt;
07/03/2011 15:06,07/03/2011 15:06,...,... Monitor ...,CLOSED,WARNING,Appmon,0,etcetc&lt;BR /&gt;
OR&lt;BR /&gt;&lt;BR /&gt;
07/03/2011 14:55,07/03/2011 14:55,...,..,...,CLOSED,NORMAL,SNMP,0,etcetc&lt;/P&gt;

&lt;P&gt;so.. im trying to extract the [warning] &lt;BR /&gt;
which varies from "Warning","Normal","Major","Minor","Critical","Unknown"&lt;/P&gt;

&lt;P&gt;however Web extraction gives me: "(?i),CLOSED,(?P&lt;FIELDNAME&gt;[^,]+)"&lt;BR /&gt;
but the field before it could be "OPEN" as well. I tried to add a CLOSED|OPEN but it became an error. can someone enlighten me?&lt;/FIELDNAME&gt;&lt;/P&gt;

&lt;P&gt;another field im having trouble is [source]&lt;BR /&gt;
the regex was based on the number of commas, however, from the 2 examples i given, this is not necessarily true as well. they vary from 5(1st and 2nd) to 6 (3rd log). this problem is similar to my first question. &lt;/P&gt;

&lt;P&gt;Thanks for taking your time to read!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2012 07:15:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66811#M16655</guid>
      <dc:creator>attgjh1</dc:creator>
      <dc:date>2012-06-04T07:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Varying Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66812#M16656</link>
      <description>&lt;P&gt;The following &lt;CODE&gt;rex&lt;/CODE&gt; statement should bring out the information as &lt;CODE&gt;warning_level&lt;/CODE&gt; and &lt;CODE&gt;the_source&lt;/CODE&gt;. I don't think you can extract a field called &lt;CODE&gt;source&lt;/CODE&gt; (or &lt;CODE&gt;sourcetype&lt;/CODE&gt; etc) since that is a default field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex ",\[(?&amp;lt;warning_level&amp;gt;\w+)\],\s*\[(?&amp;lt;the_source&amp;gt;\w+)\]$" |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note: I added a possible whitespace between &lt;CODE&gt;warning_level&lt;/CODE&gt; and &lt;CODE&gt;the_source&lt;/CODE&gt;, since your example didn't really show the actual format. Remove if not applicable.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;UPDATE: &lt;/P&gt;

&lt;P&gt;Well that pretty much changed the game. There are no longer any square brackets in your events, and the line does not end where you said it did... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex ",(OPEN|CLOSED),(?&amp;lt;warning_level&amp;gt;\w+),(?&amp;lt;the_source&amp;gt;\w+)," |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should work better with your sample above.&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2012 08:42:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66812#M16656</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-06-04T08:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Varying Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66813#M16657</link>
      <description>&lt;P&gt;ive added the actual details of the log.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2012 08:53:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66813#M16657</guid>
      <dc:creator>attgjh1</dc:creator>
      <dc:date>2012-06-04T08:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Varying Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66814#M16658</link>
      <description>&lt;P&gt;see update above /k&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2012 15:37:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66814#M16658</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-06-04T15:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Varying Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66815#M16659</link>
      <description>&lt;P&gt;Thanks alot. it helped. &lt;/P&gt;

&lt;P&gt;now im gng try some stats/charts to show the source over warninglevels~~~ &lt;/P&gt;

&lt;P&gt;here's a cookie.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2012 01:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66815#M16659</guid>
      <dc:creator>attgjh1</dc:creator>
      <dc:date>2012-06-05T01:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Varying Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66816#M16660</link>
      <description>&lt;P&gt;&lt;CODE&gt;chart c over the_source by warning_level&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:54:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Varying-Field-Extractions/m-p/66816#M16660</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2020-09-28T11:54:04Z</dc:date>
    </item>
  </channel>
</rss>

