<?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 What regular expression do I use to create a new field from a portion of existing field results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253896#M76026</link>
    <description>&lt;P&gt;New to regular expression.... &lt;/P&gt;

&lt;P&gt;I'm trying to create a new field called Application that is populated from a part of an results from an existing field called AppDomain.  Here's my query to show results &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webapps host=order* AppDomain="*OrderProcess*" "*error*" OR "*exception*" | rex field=AppDomain "(?)" | stats count by AppDomain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;AppDomain &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/LM/W3SVC/4/ROOT/OrderProcess-1-131296677359969243  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677360750538  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677362395141  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677362906184  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677397950430  
/LM/W3SVC/4/ROOT/OrderProcess-1-131297882853714324  
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678334631161   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678335308894   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678335390763   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678335627626   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678336195945   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678337194875   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131297882853714324   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131296677773203879   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131296678051860064   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131296678052119089   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131297720946816171
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm only interested in the the OrderProcess portion so the regular expression should begin after the ROOT/ and before -1 or -2 -d&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jan 2017 19:41:14 GMT</pubDate>
    <dc:creator>jward6004</dc:creator>
    <dc:date>2017-01-25T19:41:14Z</dc:date>
    <item>
      <title>What regular expression do I use to create a new field from a portion of existing field results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253896#M76026</link>
      <description>&lt;P&gt;New to regular expression.... &lt;/P&gt;

&lt;P&gt;I'm trying to create a new field called Application that is populated from a part of an results from an existing field called AppDomain.  Here's my query to show results &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webapps host=order* AppDomain="*OrderProcess*" "*error*" OR "*exception*" | rex field=AppDomain "(?)" | stats count by AppDomain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;AppDomain &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/LM/W3SVC/4/ROOT/OrderProcess-1-131296677359969243  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677360750538  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677362395141  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677362906184  
/LM/W3SVC/4/ROOT/OrderProcess-1-131296677397950430  
/LM/W3SVC/4/ROOT/OrderProcess-1-131297882853714324  
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678334631161   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678335308894   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678335390763   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678335627626   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678336195945   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131296678337194875   
/LM/W3SVC/4/ROOT/OrderProcessMVC-2-131297882853714324   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131296677773203879   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131296678051860064   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131296678052119089   
/LM/W3SVC/5/ROOT/OrderProcessMVC-2-131297720946816171
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm only interested in the the OrderProcess portion so the regular expression should begin after the ROOT/ and before -1 or -2 -d&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 19:41:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253896#M76026</guid>
      <dc:creator>jward6004</dc:creator>
      <dc:date>2017-01-25T19:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: What regular expression do I use to create a new field from a portion of existing field results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253897#M76027</link>
      <description>&lt;P&gt;If the position of the OrderProcess portion is fixed (5th segment from start), try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webapps host=order* AppDomain="*OrderProcess*" "*error*" OR "*exception*" | rex field=AppDomain "^\/([^\/]+\/){4}(?&amp;lt;AppDomain&amp;gt;[^-]+)" | stats count by AppDomain
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jan 2017 20:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253897#M76027</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-25T20:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: What regular expression do I use to create a new field from a portion of existing field results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253898#M76028</link>
      <description>&lt;P&gt;Thanks @somesoni2, that works great! Would you mind explaining what the regex does to cut off the end of the query and start with appdomain?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 21:04:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253898#M76028</guid>
      <dc:creator>jward6004</dc:creator>
      <dc:date>2017-01-25T21:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: What regular expression do I use to create a new field from a portion of existing field results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253899#M76029</link>
      <description>&lt;P&gt;The &lt;CODE&gt;^\/&lt;/CODE&gt; denotes the start of the event, including first forward slash. From there &lt;CODE&gt;([^\/]+\/)&lt;/CODE&gt; captures all characters till next forward slash, including forward slash (e.g. &lt;CODE&gt;LM/&lt;/CODE&gt; ,  or  &lt;CODE&gt;W3SVC/&lt;/CODE&gt; etc). The &lt;CODE&gt;{4}&lt;/CODE&gt; denotes 4 such values, so covers till &lt;CODE&gt;/anything/anything/anything/anything/&lt;/CODE&gt;, e.g. &lt;CODE&gt;/LM/W3SVC/5/ROOT/&lt;/CODE&gt;. Then it captures everything till first hypher, that is the values that you're interested in.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 21:21:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253899#M76029</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-25T21:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: What regular expression do I use to create a new field from a portion of existing field results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253900#M76030</link>
      <description>&lt;P&gt;Thanks that helps me read the regex and for future reference&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 00:21:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-regular-expression-do-I-use-to-create-a-new-field-from-a/m-p/253900#M76030</guid>
      <dc:creator>jward6004</dc:creator>
      <dc:date>2017-01-26T00:21:10Z</dc:date>
    </item>
  </channel>
</rss>

