<?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: Using multiple REGEX for extracting a single field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-multiple-REGEX-for-extracting-a-single-field/m-p/134088#M36632</link>
    <description>&lt;P&gt;You can use multiple regular expressions to extract one field from differently structured events... but not like that. You can for example put two &lt;CODE&gt;EXTRACT-foo&lt;/CODE&gt; lines into your props.conf that each extract the same field name.&lt;/P&gt;

&lt;P&gt;Do post some sample data.&lt;/P&gt;</description>
    <pubDate>Sun, 21 Sep 2014 13:42:59 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-09-21T13:42:59Z</dc:date>
    <item>
      <title>Using multiple REGEX for extracting a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-multiple-REGEX-for-extracting-a-single-field/m-p/134087#M36631</link>
      <description>&lt;P&gt;I want to extract fields from a customized log (no pre-defined/standard log structure)&lt;/P&gt;

&lt;P&gt;I do need to extract a field name "Description" where it has its appropriate values at different locations in various events.&lt;BR /&gt;
Using multilple REGEX alone I can able to locate the values.&lt;/P&gt;

&lt;P&gt;Can i use multiple REGEX to extract a single field ?&lt;/P&gt;

&lt;P&gt;My config files:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[myprops]
REPORT-Description = extract_desc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract_desc]
REGEX = (,DESC,)
REGEX = (\((\d|)\))
FORMAT = Description::$1
FORMAT = Description::$2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying to achieve as above , Is this correct way ? &lt;/P&gt;</description>
      <pubDate>Sun, 21 Sep 2014 04:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-multiple-REGEX-for-extracting-a-single-field/m-p/134087#M36631</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2014-09-21T04:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiple REGEX for extracting a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-multiple-REGEX-for-extracting-a-single-field/m-p/134088#M36632</link>
      <description>&lt;P&gt;You can use multiple regular expressions to extract one field from differently structured events... but not like that. You can for example put two &lt;CODE&gt;EXTRACT-foo&lt;/CODE&gt; lines into your props.conf that each extract the same field name.&lt;/P&gt;

&lt;P&gt;Do post some sample data.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Sep 2014 13:42:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-multiple-REGEX-for-extracting-a-single-field/m-p/134088#M36632</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-09-21T13:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiple REGEX for extracting a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-multiple-REGEX-for-extracting-a-single-field/m-p/134089#M36633</link>
      <description>&lt;P&gt;I really have no idea what your logs look like, but from your description, they may have the form:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...,DESC,(1),...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In which case the following props.conf regex will catch it if the value is always digits:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-foo=,DESC,\((?P&amp;lt;Description&amp;gt;\d*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There is no need for transforms unless there are multiple values of "Description" in a single event, or you also need to extract the field value from each event because it changes.&lt;BR /&gt;
Also, there can only be one regex per transforms entry, even though that one regex may extract multiple fields.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2015 22:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-multiple-REGEX-for-extracting-a-single-field/m-p/134089#M36633</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2015-08-05T22:38:52Z</dc:date>
    </item>
  </channel>
</rss>

