<?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 Option to extract one specific field from different patterns in one go ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354990#M105020</link>
    <description>&lt;P&gt;For the same sourcetype, I have a lot many different patterns from which I want to extract one specific field. Is there an option to handle all these extractions (same sourcetype different patterns) in one go instead of going via multiple regex field extractions ?&lt;/P&gt;</description>
    <pubDate>Wed, 08 Nov 2017 03:21:08 GMT</pubDate>
    <dc:creator>pari04home</dc:creator>
    <dc:date>2017-11-08T03:21:08Z</dc:date>
    <item>
      <title>Option to extract one specific field from different patterns in one go ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354990#M105020</link>
      <description>&lt;P&gt;For the same sourcetype, I have a lot many different patterns from which I want to extract one specific field. Is there an option to handle all these extractions (same sourcetype different patterns) in one go instead of going via multiple regex field extractions ?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 03:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354990#M105020</guid>
      <dc:creator>pari04home</dc:creator>
      <dc:date>2017-11-08T03:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Option to extract one specific field from different patterns in one go ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354991#M105021</link>
      <description>&lt;P&gt;regex supports an "OR" operator by using a pipe character "|" between matching expressions.&lt;BR /&gt;&lt;BR /&gt;
For example (comes with Splunk)&lt;BR /&gt;
    (?:objectguid|guid)\s*=\s*(?&lt;GUID_LOOKUP&gt;[\w-]+) &lt;/GUID_LOOKUP&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:38:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354991#M105021</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2020-09-29T16:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Option to extract one specific field from different patterns in one go ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354992#M105022</link>
      <description>&lt;P&gt;Without clarity in data constraints, like what does it mean by "different patterns" and "one specific field", it is hard to give any definitive answer.  Are you looking for the same type of data embedded in different contexts, or are you looking for a potentially different data type when context is different?  Regex is extremely versatile when matching patterns if you are willing to invest in it.  It all depends on the actual data, is there an order of appearance for patterns, how regular the rest of the patterns are, and so on.  In my experience, there are advantages and disadvantages for one-go vs multiple rex commands.  If you know your data well, it is nearly always possible to construct a single rex command to extract every pattern if you work hard enough.  But if you want to capture just those combinations that you haven't thought of, multiple runs are easier.&lt;/P&gt;

&lt;P&gt;One whacky example is this pair of constructs:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;William is my nephew&lt;BR /&gt;
My auntie is Betty&lt;BR /&gt;
How to extract the relationship in one go?  You can use  &lt;CODE&gt;^((?&amp;lt;name&amp;gt;.+) (is|are) (my|our|your|his|her|their) (?&amp;lt;relation&amp;gt;.+)|(My|Our|Your|His|Her|Their) (?&amp;lt;relation&amp;gt;.+) (is|are) (my|our|your|his|her|their) (?&amp;lt;name&amp;gt;.+))&lt;/CODE&gt;.  Is this doable?  Perhaps yes.  Is this practical?  Probably not.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Machine data are probably better than natural language.  But if you are parsing application logs, more often than not, different pieces of a pattern may appear in some context and not in others.  Nowadays I just use multiple passes unless I have confidence that the data space is limited.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 05:48:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354992#M105022</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2017-11-08T05:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Option to extract one specific field from different patterns in one go ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354993#M105023</link>
      <description>&lt;P&gt;@pari04home, as you would understand, if you have multiple patterns within your sourcetype you would need to provide us with mock/sample data for all possible patterns for us to assist you with your regular expression.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 06:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Option-to-extract-one-specific-field-from-different-patterns-in/m-p/354993#M105023</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-08T06:45:15Z</dc:date>
    </item>
  </channel>
</rss>

