<?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: Extract field using rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566725#M197487</link>
    <description>&lt;P&gt;The regex says to capture everything until the first equals sign so, of course, equals signs are not captured.&amp;nbsp; Your sample events don't have equals signs in the loginName field so the existing regex should be fine.&amp;nbsp; If you have examples of loginName values with "=" in them then please share.&amp;nbsp; To capture up to the first whitespace, use &lt;FONT face="courier new,courier"&gt;\S+&lt;/FONT&gt;.&lt;/P&gt;</description>
    <pubDate>Sat, 11 Sep 2021 16:49:22 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2021-09-11T16:49:22Z</dc:date>
    <item>
      <title>Extract field using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566702#M197474</link>
      <description>&lt;P&gt;I have the below test raw logs&lt;/P&gt;&lt;P&gt;CEF:0|Forcepoint|Forcepoint DLP|8.8.0|55564097|DLP Syslog|2| act=Permitted duser=destuser@gmail.com fname=testfile.PDF.TXT - 11.01 KB msg=EndPoint Operation suser=User, Test cat=Test Category sourceServiceName=Endpoint Printing analyzedBy=Policy Engine testengine loginName=testuser1 sourceIp=N/A severityType=LOW sourceHost=testhost productVersion=8.0 maxMatches=0 timeStamp=2021-09-01 15:58:50.624 destinationHosts=N/A eventId=4762037341417287789&lt;/P&gt;&lt;P&gt;CEF:0|Forcepoint|Forcepoint DLP|8.8.0|55564097|DLP Syslog|2| act=Permitted duser=destuser@gmail.com fname=testfile.PDF.TXT - 11.01 KB msg=EndPoint Operation suser=User, Test cat=Test Category sourceServiceName=Endpoint Printing analyzedBy=Policy Engine testengine loginName=domain\\testuser sourceIp=N/A severityType=LOW sourceHost=testhost productVersion=8.0 maxMatches=0 timeStamp=2021-09-02 15:58:50.624 destinationHosts=N/A eventId=4762037341417287788&lt;/P&gt;&lt;P&gt;CEF:0|Forcepoint|Forcepoint DLP|8.8.0|55564097|DLP Syslog|2| act=Permitted duser=destuser@gmail.com fname=testfile.PDF.TXT - 11.01 KB msg=EndPoint Operation suser=User, Test cat=Test Category sourceServiceName=Endpoint Printing analyzedBy=Policy Engine testengine loginName=tuser sourceIp=N/A severityType=LOW sourceHost=testhost productVersion=8.0 maxMatches=0 timeStamp=2021-09-04 15:58:50.624 destinationHosts=N/A eventId=4762037341417287787&lt;/P&gt;&lt;P&gt;CEF:0|Forcepoint|Forcepoint DLP|8.8.0|55564097|DLP Syslog|2| act=Permitted duser=destuser@gmail.com fname=testfile.PDF.TXT - 11.01 KB msg=EndPoint Operation suser=User, Test cat=Test Category sourceServiceName=Endpoint Printing analyzedBy=Policy Engine testengine loginName=N/A sourceIp=N/A severityType=LOW sourceHost=testhost productVersion=8.0 maxMatches=0 timeStamp=2021-09-03 15:58:50.624 destinationHosts=N/A eventId=4762037341417287786&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use rex to extract a field called loginName, in which the regex will capture all entries after the "loginName=" text.&lt;/P&gt;&lt;P&gt;I have tried ...| rex field=_raw "(loginName=)(?&amp;lt;loginName&amp;gt;[^\=]+)(?=\s)", but it does not capture all events.&lt;/P&gt;&lt;P&gt;Please assist.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 23:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566702#M197474</guid>
      <dc:creator>osasfrancis</dc:creator>
      <dc:date>2021-09-10T23:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566704#M197475</link>
      <description>&lt;P&gt;Your regex and this simplified version of it&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;loginName=(?&amp;lt;loginName&amp;gt;[^=]+)\s&lt;/LI-CODE&gt;&lt;P&gt;works fine with the sample events.&amp;nbsp; Please share an event where the regex fails.&amp;nbsp; Or show the expected results and your actual results.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Sep 2021 00:14:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566704#M197475</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-09-11T00:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566721#M197483</link>
      <description>&lt;P&gt;I wouldn't capture [^=]. Maybe in this particular case you don't have users with "=" in the middle of their login but in general, I'd try to come up with a more generalized solution (like capturing up to a first whitespace?).&lt;/P&gt;</description>
      <pubDate>Sat, 11 Sep 2021 16:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566721#M197483</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-11T16:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566725#M197487</link>
      <description>&lt;P&gt;The regex says to capture everything until the first equals sign so, of course, equals signs are not captured.&amp;nbsp; Your sample events don't have equals signs in the loginName field so the existing regex should be fine.&amp;nbsp; If you have examples of loginName values with "=" in them then please share.&amp;nbsp; To capture up to the first whitespace, use &lt;FONT face="courier new,courier"&gt;\S+&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Sep 2021 16:49:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566725#M197487</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-09-11T16:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566806#M197515</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you &amp;nbsp;can play with this by&amp;nbsp;&lt;A href="https://regex101.com/r/10Rhs4/1" target="_blank"&gt;https://regex101.com/r/10Rhs4/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Rich's regex handle also spaces on name which didn't happen if you are using whitespace as end character.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 08:23:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566806#M197515</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-09-13T08:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566817#M197522</link>
      <description>&lt;P&gt;I don't recall, to be completely honest, what the CEF specification says - where can there be spaces or equal signs. It'd be most reasonable to check with the specs and adjust the regex accordingly. As we can see from the example surely the values can have unescaped spaces. I'm not sure about equal signs in values and spaces in key names. And I'm not 100% sure whether this is a proper CEF &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 09:24:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566817#M197522</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-13T09:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566875#M197546</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This solved my problem. Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 14:43:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-using-rex/m-p/566875#M197546</guid>
      <dc:creator>osasfrancis</dc:creator>
      <dc:date>2021-09-13T14:43:48Z</dc:date>
    </item>
  </channel>
</rss>

