<?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: How to extract fields (in props.conf) based on conditional regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628011#M218181</link>
    <description>&lt;P&gt;Ciao &lt;SPAN&gt;Giuseppe,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Testing is tricky; configuration in props.conf vs the web GUI need to be implemented differently as my events have blackslashes and double quotes.&amp;nbsp; So just using the web GUI for now, I have (note how I have had to specific 4 x backslash):&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;| makeresults &lt;BR /&gt;| eval account="notification that user mydomain\bob has,notification that user fred has,notification that user 01\ralph has" &lt;BR /&gt;| makemv account delim="," &lt;BR /&gt;| mvexpand account&lt;BR /&gt;| rex field=account "notification that user (?&amp;lt;domain&amp;gt;[\w\d]+)\\\\"&lt;BR /&gt;| fillnull domain value="NULL"&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I have removed the double quotes around each domain\user and user for now as that was making things even trickier (I'll resolve that later)&lt;BR /&gt;&lt;BR /&gt;This gives me the domain as per the event or NULL, which is great.&amp;nbsp; Any thoughts on how to get the user in both cases -- when there is a domain and when there isn't?&amp;nbsp; My regex attempts suck in the domain as the user.&lt;BR /&gt;&lt;BR /&gt;I need something like &lt;FONT face="courier new,courier"&gt;if domain != NULL regex_to_get_user&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2023 16:28:48 GMT</pubDate>
    <dc:creator>Jamie</dc:creator>
    <dc:date>2023-01-23T16:28:48Z</dc:date>
    <item>
      <title>How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/627967#M218167</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My events contain strings such as:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;notification that user "mydomain\bob" has&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;notification that user "fred" has&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;notification that user "01\ralph2" has&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I'm trying to write a conditional EXTRACT in &lt;FONT face="courier new,courier"&gt;props.conf&lt;/FONT&gt;, so that&amp;nbsp;the a new field 'domain' is assgined the domain name (i.e. mydomain, 01) where specified, else is assigned NULL and new field 'user' is assigned the user name (i.e. bob, fred, ralph2).&lt;/P&gt;&lt;P&gt;This works well enough when there is a domain and a user, but oviously not when there isn't a domain:&lt;/P&gt;&lt;PRE&gt;EXTRACT-domain_user = notification\sthat\suser\s\"(?&amp;lt;domain&amp;gt;[\w\d]+)\\(?&amp;lt;user&amp;gt;[\w\d]+)\"\shas&lt;/PRE&gt;&lt;P&gt;I'd be grateful for some assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 11:17:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/627967#M218167</guid>
      <dc:creator>Jamie</dc:creator>
      <dc:date>2023-01-23T11:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/627973#M218169</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238315"&gt;@Jamie&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could extract the domain using a regex like the following&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "notification that user \"(?&amp;lt;domain&amp;gt;\w+)\\"&lt;/LI-CODE&gt;&lt;P&gt;and then use fillnull to give the NULL value if there isn't the domain:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "notification that user \"(?&amp;lt;domain&amp;gt;\w+)\\"
| fillnull domain value="NULL"&lt;/LI-CODE&gt;&lt;P&gt;You can also extract the domain field ad a field extraction and the NULL assign as an automatic field.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 12:31:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/627973#M218169</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-23T12:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628011#M218181</link>
      <description>&lt;P&gt;Ciao &lt;SPAN&gt;Giuseppe,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Testing is tricky; configuration in props.conf vs the web GUI need to be implemented differently as my events have blackslashes and double quotes.&amp;nbsp; So just using the web GUI for now, I have (note how I have had to specific 4 x backslash):&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;| makeresults &lt;BR /&gt;| eval account="notification that user mydomain\bob has,notification that user fred has,notification that user 01\ralph has" &lt;BR /&gt;| makemv account delim="," &lt;BR /&gt;| mvexpand account&lt;BR /&gt;| rex field=account "notification that user (?&amp;lt;domain&amp;gt;[\w\d]+)\\\\"&lt;BR /&gt;| fillnull domain value="NULL"&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I have removed the double quotes around each domain\user and user for now as that was making things even trickier (I'll resolve that later)&lt;BR /&gt;&lt;BR /&gt;This gives me the domain as per the event or NULL, which is great.&amp;nbsp; Any thoughts on how to get the user in both cases -- when there is a domain and when there isn't?&amp;nbsp; My regex attempts suck in the domain as the user.&lt;BR /&gt;&lt;BR /&gt;I need something like &lt;FONT face="courier new,courier"&gt;if domain != NULL regex_to_get_user&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 16:28:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628011#M218181</guid>
      <dc:creator>Jamie</dc:creator>
      <dc:date>2023-01-23T16:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628016#M218184</link>
      <description>&lt;P&gt;This seems to work:&lt;/P&gt;&lt;PRE&gt;| makeresults &lt;BR /&gt;| eval account="notification that user \"mydomain\bob\" has,notification that user \"fred\" has,notification that user \"01\ralph\" has" &lt;BR /&gt;| makemv account delim="," &lt;BR /&gt;| mvexpand account&lt;BR /&gt;| rex field=account "notification that user \"(?&amp;lt;domain&amp;gt;[\w\d]+)(\\\\)"&lt;BR /&gt;| rex field=account "notification that user \"(\w+\\\\)?(?&amp;lt;user&amp;gt;[\w\d]+)"&lt;BR /&gt;| fillnull domain value="NULL"&lt;/PRE&gt;&lt;P&gt;I might need to tweak the character elements to cater for my domain\user variants...but for now...&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 17:19:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628016#M218184</guid>
      <dc:creator>Jamie</dc:creator>
      <dc:date>2023-01-23T17:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628029#M218187</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238315"&gt;@Jamie&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Please accept one answer for the other people of Community&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 18:47:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628029#M218187</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-23T18:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628289#M218247</link>
      <description>&lt;P&gt;I had quite a lot of trouble getting the regexes that worked in the GUI to work in props.conf, however, I finally found that this works:&lt;/P&gt;&lt;PRE&gt;EXTRACT-domain = notification that user \"(?&amp;lt;domain&amp;gt;[\w\d]+)(\\)&lt;BR /&gt;EXTRACT-user = notification that user \"([\w\d]+(\\))?(?&amp;lt;user&amp;gt;[\w\d]+)\"&lt;BR /&gt;EVAL-domain = if(isnull(domain), "localhost", domain)&lt;/PRE&gt;&lt;P&gt;I'd be grateful if someone could explain why:&lt;/P&gt;&lt;P&gt;- it was necessary for &lt;FONT face="courier new,courier"&gt;EXTRACT-domain&lt;/FONT&gt; in the GUI to use four backslashes.&lt;/P&gt;&lt;P&gt;- it was necessary for &lt;FONT face="courier new,courier"&gt;EXTRACT-domain&lt;/FONT&gt; in &lt;FONT face="courier new,courier"&gt;props.conf&lt;/FONT&gt; to only need two backslashes in a capture group.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 15:29:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628289#M218247</guid>
      <dc:creator>Jamie</dc:creator>
      <dc:date>2023-01-25T15:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628296#M218248</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238315" target="_blank"&gt;@Jamie&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;as I said, good for you, see next time!&lt;/P&gt;&lt;P&gt;Please accept one answer for the other people of Community&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated&lt;SPAN&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 15:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628296#M218248</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-25T15:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields (in props.conf) based on conditional regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628305#M218249</link>
      <description>&lt;P&gt;FYI - The two extracts could be done as follows (courtesy of a colleague):&lt;/P&gt;&lt;PRE&gt;EXTRACT-user_domain = notification that user \"(?&amp;lt;domain&amp;gt;[\w\d.]+\\)?(?&amp;lt;user&amp;gt;[^\"]+)\"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 16:04:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-in-props-conf-based-on-conditional-regex/m-p/628305#M218249</guid>
      <dc:creator>Jamie</dc:creator>
      <dc:date>2023-01-25T16:04:52Z</dc:date>
    </item>
  </channel>
</rss>

