<?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: Help with extracting fields using numeric range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26459#M5116</link>
    <description>&lt;P&gt;From the line you have listed your are going to match something like the following:
plugin_id="1001" unrelatedInfoThatWillBeMatched somelog="   snortSignature anythingElse&lt;/P&gt;

&lt;P&gt;The parenthetical value will be:
snortSignature anythingElse&lt;/P&gt;

&lt;P&gt;The [^,]+ part will match anything anything after your first match as it is essentially looking for anything that could be considered the start of a line.&lt;/P&gt;

&lt;P&gt;I don't know what your events look like but you might want to try the following regex, which I based on your own regex, to hopefully match what I think the event may contain.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;plugin_id="10\d[1,3,4-9]"|"11[0-2]\d"|"113[0-1]".*log="\s*(?P&amp;lt;snort_signature&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will the plugin_id match an event that looks somewhat like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;plugin_id="1001" irrelevantInfo somelog="   snort123" more irrelevantInfo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The extracted value for snort_signature will be: snort123&lt;/P&gt;

&lt;P&gt;Furthermore, the extraction is going to depend on what you have defined in your snort_signature stanza in your transforms.conf file.&lt;/P&gt;

&lt;P&gt;If you can provide an example line that you are trying to extract fields from then we can see about fine tuning the extraction regex to match what you are looking for. &lt;/P&gt;</description>
    <pubDate>Fri, 14 Jan 2011 20:38:07 GMT</pubDate>
    <dc:creator>Rob</dc:creator>
    <dc:date>2011-01-14T20:38:07Z</dc:date>
    <item>
      <title>Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26457#M5114</link>
      <description>&lt;P&gt;I am trying to create a field extraction for events where a &lt;CODE&gt;plugin_id&lt;/CODE&gt; field matches a range of numbers.&lt;/P&gt;

&lt;P&gt;This search returns all of the events that I want:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=ossim "Event received" ((plugin_id&amp;gt;=1001 AND plugin_id&amp;lt;=1131) NOT plugin_id=1002))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the regex to extract the &lt;CODE&gt;signature_id&lt;/CODE&gt; from the events.  If I hard-code the &lt;CODE&gt;plugin_id&lt;/CODE&gt; in the regex, the extraction works.  If I try and use the numeric ranges listed below, it fails:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-snort_signature (?i) plugin_id="10[0-9][0-9]|11[0-2][0-9]|113[0-1]".*log="\s*(?P&amp;lt;snort_signature&amp;gt;[^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why isn't this extracting the signature properly?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 06:32:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26457#M5114</guid>
      <dc:creator>jambajuice</dc:creator>
      <dc:date>2011-01-14T06:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26458#M5115</link>
      <description>&lt;P&gt;Your extract line is missing an '=' after EXTRACT-snort_signature -- just a typo?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 07:02:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26458#M5115</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-01-14T07:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26459#M5116</link>
      <description>&lt;P&gt;From the line you have listed your are going to match something like the following:
plugin_id="1001" unrelatedInfoThatWillBeMatched somelog="   snortSignature anythingElse&lt;/P&gt;

&lt;P&gt;The parenthetical value will be:
snortSignature anythingElse&lt;/P&gt;

&lt;P&gt;The [^,]+ part will match anything anything after your first match as it is essentially looking for anything that could be considered the start of a line.&lt;/P&gt;

&lt;P&gt;I don't know what your events look like but you might want to try the following regex, which I based on your own regex, to hopefully match what I think the event may contain.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;plugin_id="10\d[1,3,4-9]"|"11[0-2]\d"|"113[0-1]".*log="\s*(?P&amp;lt;snort_signature&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will the plugin_id match an event that looks somewhat like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;plugin_id="1001" irrelevantInfo somelog="   snort123" more irrelevantInfo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The extracted value for snort_signature will be: snort123&lt;/P&gt;

&lt;P&gt;Furthermore, the extraction is going to depend on what you have defined in your snort_signature stanza in your transforms.conf file.&lt;/P&gt;

&lt;P&gt;If you can provide an example line that you are trying to extract fields from then we can see about fine tuning the extraction regex to match what you are looking for. &lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 20:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26459#M5116</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2011-01-14T20:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26460#M5117</link>
      <description>&lt;P&gt;He won't need the '=' as he is not using any options for the extract command and apparently making a call to a stanza labeled 'snort_signature' in his transforms.conf. However, in case the extract syntax needs to be checked, here is the documentation reference &lt;A href="http://www.splunk.com/base/Documentation/4.1.6/SearchReference/Extract"&gt;http://www.splunk.com/base/Documentation/4.1.6/SearchReference/Extract&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2011 20:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26460#M5117</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2011-01-14T20:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26461#M5118</link>
      <description>&lt;P&gt;Rob, EXTRACT-snort_signature is a configuration in props.conf which will not rely on transforms.conf (that would be something like REPORT-snort_signature = transforms_stanza_name). It isn't the extract search command. Thus southeringtonp's comment. &lt;BR /&gt;
Also, in regex language, [^,]+ means "everything that's not a comma": the ^ as the first char inside a character classes ([]) is a negation.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:23:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26461#M5118</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2020-09-28T09:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26462#M5119</link>
      <description>&lt;P&gt;The | in regexes has to be constrained by round brackets, otherwise it will "split" your regex in two pieces and use them as alternative matches. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-snort_signature = (?i) plugin_id="(?:10[0-9][0-9]|11[0-2][0-9]|113[0-1])".*log="\s*(?P&amp;lt;snort_signature&amp;gt;[^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The (?: creates a non-capturing subpattern. 
I have also noticed that your regex does not take into account the log field's ending ", so you might want to check that too.&lt;/P&gt;

&lt;P&gt;Also, basing myself on this sample line I've found elsewhere:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2010-11-18 15:46:20 OSSIM-Message: Event received: event id="0" alarm="0" type="detector" fdate="1969-12-31 19:33:30" date="2010" tzone="0" plugin_id="1001" plugin_sid="1394" src_ip="63.215.202.48" src_port="80" dst_ip="82.150.0.6" dst_port="8197" sensor="10.1.116.31" interface="eth1" protocol="TCP" asset_src="2" asset_dst="2" log="[**] [1:1394:12] SHELLCODE x86 inc ecx NOOP [**] [Classification: Executable code was detected] [Priority: 1] 11/18-15:47:00.198740 63.215.202.48:80 -&amp;gt; 82.150.0.6:8197"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you have not altered Splunk's automated field extraction, you would end up with a ton of fields, including plugin_id and log. Why not just alias the field "log" to "snort_signature" in props.conf?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FIELDALIAS-sno_sig = log as snort_signature
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would sure enhance performance, but make the aliased field available to all the plugin_id values. &lt;/P&gt;</description>
      <pubDate>Sun, 16 Jan 2011 23:17:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26462#M5119</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2011-01-16T23:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26463#M5120</link>
      <description>&lt;P&gt;Paolo, you are correct with the caret immediately after the bracket. However, since there is no closing quote, it means that everything after the beginning quote will be matched to the &lt;SNORT_SIGNATURE&gt; field that is to be mapped. Without an event line to customize this to, we are making more of a guess as to what the specific regex should be.&lt;/SNORT_SIGNATURE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2011 21:06:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26463#M5120</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2011-01-17T21:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with extracting fields using numeric range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26464#M5121</link>
      <description>&lt;P&gt;However, in reference to the EXTRACT syntax being used, here is an excerpt from the Splunk documentation found at &lt;A href="http://www.splunk.com/base/Documentation/4.1.6/SearchReference/Extract"&gt;http://www.splunk.com/base/Documentation/4.1.6/SearchReference/Extract&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;EXTRACTOR-NAME&gt;&lt;BR /&gt;
Syntax: &lt;STRING&gt;&lt;BR /&gt;
Description: A stanza that can be found in transforms.conf. This is used when props.conf did not explicitly cause an extraction for this source, sourcetype, or host.&lt;/STRING&gt;&lt;/EXTRACTOR-NAME&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2011 21:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-extracting-fields-using-numeric-range/m-p/26464#M5121</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2011-01-17T21:06:53Z</dc:date>
    </item>
  </channel>
</rss>

