<?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: Complex Regex, HELP! in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159135#M44888</link>
    <description>&lt;P&gt;I'm going to suggest this --&amp;gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = (?m)&amp;lt;LogEventTypeCode&amp;gt;(?!SEC_EVENT).*\&amp;lt;BusinessDomainId\&amp;gt;(BusinessDomainId1|BusinessDomainId2|BusinessDomainId3)\&amp;lt;/BusinessDomainId\&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Which wraps poorly)&lt;/P&gt;

&lt;P&gt;I think this is what you want just stated (a little) differently.  I'm using a "negative lookahead assertion" operator - which says (roughly):&lt;/P&gt;

&lt;P&gt;"&lt;CODE&gt;LogEventTypeCode&lt;/CODE&gt; followed by anything BUT &lt;CODE&gt;SEC_EVENT&lt;/CODE&gt;, followed by some anything, then &lt;CODE&gt;BusinessDomainId&lt;/CODE&gt;"&lt;/P&gt;

&lt;P&gt;If this isn't exactly it, it's close &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 09 May 2014 22:43:12 GMT</pubDate>
    <dc:creator>dwaddle</dc:creator>
    <dc:date>2014-05-09T22:43:12Z</dc:date>
    <item>
      <title>Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159128#M44881</link>
      <description>&lt;P&gt;I have a transform that I need help writing a regex for. It has two conditions. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;It needs to match the value in this field &lt;CODE&gt;&amp;lt;BusinessDomainID&amp;gt;*&amp;lt;/BusinessDomainID&amp;gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;It needs to not match this exact string &lt;CODE&gt;&amp;lt;LogEventTypeCode&amp;gt;SEC_EVENT&amp;lt;/LogEventTypeCode&amp;gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Here's what I have so far which meets the requirements for condition #1 and works correctly&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX=(?m)\&amp;lt;BusinessDomainId\&amp;gt;(BusinessDomainId1|BusinessDomainId2|BusinessDomainId3)\&amp;lt;/BusinessDomainId\&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I add condition #2 in there so it will not match if it sees &lt;CODE&gt;&amp;lt;LogEventTypeCode&amp;gt;SEC_EVENT&amp;lt;/LogEventTypeCode&amp;gt;&lt;/CODE&gt; in the same event?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Here's some raw events.&lt;BR /&gt;
This one matches condition 1 and 2&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;ELLogInputMessage&amp;gt; 
        &amp;lt;Header&amp;gt; 
            &amp;lt;LogEventTypeCode&amp;gt;SEC_EVENT&amp;lt;/LogEventTypeCode&amp;gt; 
            &amp;lt;LogSeverityCode&amp;gt;CRITICAL&amp;lt;/LogSeverityCode&amp;gt; 
            &amp;lt;LogEventDateTime&amp;gt;2014-05-06T23:59:59.9999999-05:00&amp;lt;/LogEventDateTime&amp;gt; 
        &amp;lt;/Header&amp;gt; 
        &amp;lt;SourceInformation&amp;gt; 
            &amp;lt;EAPMId&amp;gt;1&amp;lt;/EAPMId&amp;gt; 
            &amp;lt;HostMachineName&amp;gt;HostMachineName3&amp;lt;/HostMachineName&amp;gt; 
            &amp;lt;HostEnvironmentName&amp;gt;HostEnvironmentName3&amp;lt;/HostEnvironmentName&amp;gt; 
            &amp;lt;ComponentId&amp;gt;ComponentId3&amp;lt;/ComponentId&amp;gt; 
            &amp;lt;ComponentName&amp;gt;ComponentName3&amp;lt;/ComponentName&amp;gt; 
            &amp;lt;ApplicationEventCorrelationId&amp;gt;ApplicationEventCorrelationId3&amp;lt;/ApplicationEventCorrelationId&amp;gt; 
            &amp;lt;UserId&amp;gt;UserId1&amp;lt;/UserId&amp;gt; 
            &amp;lt;UserSrc&amp;gt;UserSrc1&amp;lt;/UserSrc&amp;gt; 
            &amp;lt;BusinessDomainId&amp;gt;BusinessDomainId1&amp;lt;/BusinessDomainId&amp;gt; 
            &amp;lt;BusinessDomainName&amp;gt;BusinessDomainName1&amp;lt;/BusinessDomainName&amp;gt; 
        &amp;lt;/SourceInformation&amp;gt; 
        &amp;lt;DataAccessInformation&amp;gt; 
            &amp;lt;DataCompId&amp;gt;DataCompId2&amp;lt;/DataCompId&amp;gt; 
            &amp;lt;TypeOfAccess&amp;gt;VIEW&amp;lt;/TypeOfAccess&amp;gt; 
            &amp;lt;SubjectOfInterest&amp;gt; 
                &amp;lt;SubjectId&amp;gt;SubjectId13&amp;lt;/SubjectId&amp;gt; 
                &amp;lt;SubjectName&amp;gt;SubjectName13&amp;lt;/SubjectName&amp;gt; 
                &amp;lt;SubjectDomainName&amp;gt;SubjectDomainName3&amp;lt;/SubjectDomainName&amp;gt; 
            &amp;lt;/SubjectOfInterest&amp;gt; 
            &amp;lt;AccessDateTime&amp;gt;2014-05-06T23:59:59.9999999-05:00&amp;lt;/AccessDateTime&amp;gt; 
        &amp;lt;/DataAccessInformation&amp;gt; 
        &amp;lt;DetailedLogInformation&amp;gt;anyType&amp;lt;/DetailedLogInformation&amp;gt;
    &amp;lt;/ELLogInputMessage&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;This one matches only condition 1&lt;/STRONG&gt;&lt;BR /&gt;
The only difference here is this line &lt;CODE&gt;&amp;lt;LogEventTypeCode&amp;gt;APP_EVENT&amp;lt;/LogEventTypeCode&amp;gt;&lt;/CODE&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;ELLogInputMessage&amp;gt; 
        &amp;lt;Header&amp;gt; 
            &amp;lt;LogEventTypeCode&amp;gt;APP_EVENT&amp;lt;/LogEventTypeCode&amp;gt; 
            &amp;lt;LogSeverityCode&amp;gt;CRITICAL&amp;lt;/LogSeverityCode&amp;gt; 
            &amp;lt;LogEventDateTime&amp;gt;2014-05-06T23:59:59.9999999-05:00&amp;lt;/LogEventDateTime&amp;gt; 
        &amp;lt;/Header&amp;gt; 
        &amp;lt;SourceInformation&amp;gt; 
            &amp;lt;EAPMId&amp;gt;1&amp;lt;/EAPMId&amp;gt; 
            &amp;lt;HostMachineName&amp;gt;HostMachineName3&amp;lt;/HostMachineName&amp;gt; 
            &amp;lt;HostEnvironmentName&amp;gt;HostEnvironmentName3&amp;lt;/HostEnvironmentName&amp;gt; 
            &amp;lt;ComponentId&amp;gt;ComponentId3&amp;lt;/ComponentId&amp;gt; 
            &amp;lt;ComponentName&amp;gt;ComponentName3&amp;lt;/ComponentName&amp;gt; 
            &amp;lt;ApplicationEventCorrelationId&amp;gt;ApplicationEventCorrelationId3&amp;lt;/ApplicationEventCorrelationId&amp;gt; 
            &amp;lt;UserId&amp;gt;UserId1&amp;lt;/UserId&amp;gt; 
            &amp;lt;UserSrc&amp;gt;UserSrc1&amp;lt;/UserSrc&amp;gt; 
            &amp;lt;BusinessDomainId&amp;gt;BusinessDomainId1&amp;lt;/BusinessDomainId&amp;gt; 
            &amp;lt;BusinessDomainName&amp;gt;BusinessDomainName1&amp;lt;/BusinessDomainName&amp;gt; 
        &amp;lt;/SourceInformation&amp;gt; 
        &amp;lt;DataAccessInformation&amp;gt; 
            &amp;lt;DataCompId&amp;gt;DataCompId2&amp;lt;/DataCompId&amp;gt; 
            &amp;lt;TypeOfAccess&amp;gt;VIEW&amp;lt;/TypeOfAccess&amp;gt; 
            &amp;lt;SubjectOfInterest&amp;gt; 
                &amp;lt;SubjectId&amp;gt;SubjectId13&amp;lt;/SubjectId&amp;gt; 
                &amp;lt;SubjectName&amp;gt;SubjectName13&amp;lt;/SubjectName&amp;gt; 
                &amp;lt;SubjectDomainName&amp;gt;SubjectDomainName3&amp;lt;/SubjectDomainName&amp;gt; 
            &amp;lt;/SubjectOfInterest&amp;gt; 
            &amp;lt;AccessDateTime&amp;gt;2014-05-06T23:59:59.9999999-05:00&amp;lt;/AccessDateTime&amp;gt; 
        &amp;lt;/DataAccessInformation&amp;gt; 
        &amp;lt;DetailedLogInformation&amp;gt;anyType&amp;lt;/DetailedLogInformation&amp;gt;
    &amp;lt;/ELLogInputMessage&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 May 2014 16:14:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159128#M44881</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-05-09T16:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159129#M44882</link>
      <description>&lt;P&gt;Could you post two (anonymized if you want) examples of the full event?  One that does match condition 2 and one that doesn't?  I'm not an &lt;EM&gt;expert&lt;/EM&gt; on regex by any means but I'm confident that the placement of the presence of condition 2 in the event will effect the final regex format...&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 16:19:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159129#M44882</guid>
      <dc:creator>dbylertbg</dc:creator>
      <dc:date>2014-05-09T16:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159130#M44883</link>
      <description>&lt;P&gt;Please post the actual characters (anonymized of course) for event 1 and event 2, and we can help much better. RegEx is VERY specific, and it helps to see what you're trying to match.&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 16:24:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159130#M44883</guid>
      <dc:creator>tmarlette</dc:creator>
      <dc:date>2014-05-09T16:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159131#M44884</link>
      <description>&lt;P&gt;A "not this" in regular expressions is notoriously difficult. I would suggest that you break this into two separate transforms if you can (and maybe you can't...)&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 16:55:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159131#M44884</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-05-09T16:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159132#M44885</link>
      <description>&lt;P&gt;Made an edit and added sample events&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 17:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159132#M44885</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-05-09T17:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159133#M44886</link>
      <description>&lt;P&gt;So your goal here is to build a transform that will extract a field for "BusinessDomainID" but only when the event does not also include &lt;CODE&gt;&amp;lt;LogEventTypeCode&amp;gt;SEC_EVENT&amp;lt;/LogEventTypeCode&amp;gt;&lt;/CODE&gt; ?&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 18:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159133#M44886</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2014-05-09T18:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159134#M44887</link>
      <description>&lt;P&gt;If the goal of the transforms rule is for example routing then you could split this into two regexes. One looks for your BusinessDomainID and does something, the other looks for your SEC_EVENT and un-does that something.&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 18:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159134#M44887</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-05-09T18:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159135#M44888</link>
      <description>&lt;P&gt;I'm going to suggest this --&amp;gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = (?m)&amp;lt;LogEventTypeCode&amp;gt;(?!SEC_EVENT).*\&amp;lt;BusinessDomainId\&amp;gt;(BusinessDomainId1|BusinessDomainId2|BusinessDomainId3)\&amp;lt;/BusinessDomainId\&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Which wraps poorly)&lt;/P&gt;

&lt;P&gt;I think this is what you want just stated (a little) differently.  I'm using a "negative lookahead assertion" operator - which says (roughly):&lt;/P&gt;

&lt;P&gt;"&lt;CODE&gt;LogEventTypeCode&lt;/CODE&gt; followed by anything BUT &lt;CODE&gt;SEC_EVENT&lt;/CODE&gt;, followed by some anything, then &lt;CODE&gt;BusinessDomainId&lt;/CODE&gt;"&lt;/P&gt;

&lt;P&gt;If this isn't exactly it, it's close &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 22:43:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159135#M44888</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2014-05-09T22:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159136#M44889</link>
      <description>&lt;P&gt;This picture is hanging on the 2nd floor of Splunk HQ:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/dkbyB.jpg" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 May 2014 00:31:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159136#M44889</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2014-05-10T00:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159137#M44890</link>
      <description>&lt;P&gt;@araitz - kind of big, but I like it&lt;/P&gt;</description>
      <pubDate>Sat, 10 May 2014 01:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159137#M44890</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-05-10T01:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Complex Regex, HELP!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159138#M44891</link>
      <description>&lt;P&gt;You're going to have to use a negative assertion. &lt;BR /&gt;
example:&lt;/P&gt;

&lt;P&gt;(?!.*"fill in the blank here") the quantifier will search for all instances. My response is very late so for more info just respond to this comment.&lt;/P&gt;

&lt;P&gt;Hope you found an answer. &lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 19:19:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Complex-Regex-HELP/m-p/159138#M44891</guid>
      <dc:creator>ryhluc01</dc:creator>
      <dc:date>2019-04-09T19:19:59Z</dc:date>
    </item>
  </channel>
</rss>

