<?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: Another Regex Question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350494#M103770</link>
    <description>&lt;P&gt;hey Try this run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval message.Exception="com.companyname.companyinitials.servicename.servicenameApplication.main" 
| rex field="message.Exception" "com\.companyname\.companyinitials\.(?&amp;lt;Service&amp;gt;.*)\.main"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your environment, you should write&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...query... | rex field=message.Exception "message.Exception" "com\.companyname\.companyinitials\.(?&amp;lt;Service&amp;gt;.*)\.main"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2018 06:52:18 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-01-31T06:52:18Z</dc:date>
    <item>
      <title>Another Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350491#M103767</link>
      <description>&lt;P&gt;I'm trying to rex out a new field from the message.Exception field.  What I'm trying to extract is in the brackets below (the brackets are not actually in the Splunk message):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;com.companyname.companyinitials.[servicename.servicenameApplication].main
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to make it so that the regex looks for something that starts with "com.companyname.companyinitials." and ends with ".main" as the message.Exceptions field also contains something that starts with "com.companyname.companyinitials." but it is unrelated to the field I'm trying to extract.&lt;/P&gt;

&lt;P&gt;I've tried to hack together some regex based on my google searching (I'm decent at regex for python but I can't figure out Splunk's for some reason) and I'm not doing very well.  Here's what I have so far  (which isn't working obviously):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...query... | rex field=message.Exception "com\.companyname\.companyinitials\.(?&amp;lt;Service&amp;gt;[^(main)]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm getting a new field, but it only contains one character, and it seems to be the character for the other unrelated line that starts with the same "com.companyname.companyinitials." ...  &lt;/P&gt;

&lt;P&gt;I appreciate any help - sorry for being bad at regex..&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 01:36:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350491#M103767</guid>
      <dc:creator>kwkeefer</dc:creator>
      <dc:date>2018-01-31T01:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Another Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350492#M103768</link>
      <description>&lt;P&gt;hope i understood you correctly,&lt;BR /&gt;
give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... search ... | rex field="message.Exception" "com\.companyname\.companyinitials.\[(?&amp;lt;serviceName&amp;gt;\w+)\.(?&amp;lt;serviceNameAplication&amp;gt;\w+)]\.main"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;extracting two fields: serviceName and serviceNameApllication&lt;BR /&gt;
if you want one field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... search ... | rex field="message.Exception" "com\.companyname\.companyinitials.\[(?&amp;lt;serviceName&amp;gt;\w+\.\w+)]\.main"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 02:56:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350492#M103768</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-01-31T02:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Another Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350493#M103769</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field="message.Exception"  "com\.companyname\.companyinitials\.(?&amp;lt;serviceName&amp;gt;\w+\.\w+)\.main"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 03:32:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350493#M103769</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-01-31T03:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Another Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350494#M103770</link>
      <description>&lt;P&gt;hey Try this run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval message.Exception="com.companyname.companyinitials.servicename.servicenameApplication.main" 
| rex field="message.Exception" "com\.companyname\.companyinitials\.(?&amp;lt;Service&amp;gt;.*)\.main"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your environment, you should write&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...query... | rex field=message.Exception "message.Exception" "com\.companyname\.companyinitials\.(?&amp;lt;Service&amp;gt;.*)\.main"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 06:52:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350494#M103770</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-31T06:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Another Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350495#M103771</link>
      <description>&lt;P&gt;How about trying this to save the required text in field &lt;CODE&gt;requiredText&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...query... | rex field=message.Exception "com\.companyname\.companyinitials\.(?&amp;lt;requiredText&amp;gt;[\S]+)\.main"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See extraction &lt;A href="https://regex101.com/r/2GK0SZ/1"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 16:01:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350495#M103771</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2018-01-31T16:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Another Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350496#M103772</link>
      <description>&lt;P&gt;This regex has the flaw that if there are more than two elements in the requirement stated in question and I quote &lt;CODE&gt;I need to make it so that the regex looks for something that starts with "com.companyname.companyinitials." and ends with ".main" as the message&lt;/CODE&gt; this will fail for sure.&lt;BR /&gt;
It will fail for something like this with three elements between &lt;CODE&gt;com.companyname.companyinitials&lt;/CODE&gt; and &lt;CODE&gt;.main&lt;/CODE&gt;:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;com.companyname.companyinitials.servicename.servicenameApplication.abc.main&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 17:30:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-Regex-Question/m-p/350496#M103772</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2018-01-31T17:30:11Z</dc:date>
    </item>
  </channel>
</rss>

