<?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 convert a regex to work in transforms.conf? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639992#M221774</link>
    <description>&lt;P&gt;&lt;SPAN&gt;[Username]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;REGEX = \"SubjectUserName\"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Apr 2023 19:00:47 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2023-04-14T19:00:47Z</dc:date>
    <item>
      <title>How to convert a regex to work in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639961#M221761</link>
      <description>&lt;P&gt;I am attempting (for the first tiume) to convert the following regex search to work in transforms.conf, but can't seem to get it to work. What am I missing?&lt;/P&gt;
&lt;P&gt;My search which works:&lt;/P&gt;
&lt;P&gt;index="fileshares" sourcetype="fileshares" source="/mnt/auditlog/*"&lt;BR /&gt;| rex "\"SubjectUserName\"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My attempt with transforms.conf:&lt;/P&gt;
&lt;P&gt;[Username]&lt;BR /&gt;SOURCE_KEY = Username&lt;BR /&gt;REGEX = \"SubjectUserName\"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)&lt;BR /&gt;MV_ADD = true&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Props.conf:&lt;/P&gt;
&lt;P&gt;[fileshares]&lt;BR /&gt;REPORT-fields = Username&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 16:26:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639961#M221761</guid>
      <dc:creator>hawkik1</dc:creator>
      <dc:date>2023-04-14T16:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a regex to work in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639963#M221762</link>
      <description>&lt;P&gt;Regular expressions can't be evaluated without sample data.&lt;/P&gt;&lt;P&gt;Setting &lt;FONT face="courier new,courier"&gt;MV_ADD=true&lt;/FONT&gt; is necessary only when the &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; command uses the &lt;FONT face="courier new,courier"&gt;max_match&lt;/FONT&gt; option with a value greater than zero.&lt;/P&gt;&lt;P&gt;Quotation marks do not need to be escaped in transforms.conf because the regex is not itself quoted.&lt;/P&gt;&lt;P&gt;That said, what are you trying to accomplish with transforms that &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; cannot?&amp;nbsp; If you just want to extract the Username field then use EXTRACT rather than REPORT in props and dispense with the transform.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EXTRACT-fields = "SubjectUserName"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)&lt;/LI-CODE&gt;&lt;P&gt;Keep in mind that &lt;FONT face="courier new,courier"&gt;REPORT&lt;/FONT&gt; transforms are processed at search time rather than index time.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 16:46:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639963#M221762</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-04-14T16:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a regex to work in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639971#M221763</link>
      <description>&lt;P&gt;I'm new at working with transforms.conf and props.conf. To better explain my issue. I've got an XML file that I'm trying to generate fields for.&lt;/P&gt;&lt;P&gt;I'm using this search portion which works:&lt;/P&gt;&lt;P&gt;index="fileshares" sourcetype="fileshares" source="/mnt/auditlog/*"&lt;BR /&gt;| rex "SystemTime=\"(?&amp;lt;SystemTime&amp;gt;[^\"]+)"&lt;/P&gt;&lt;P&gt;| rex "\"SubjectDomainName\"&amp;gt;(?&amp;lt;Domain&amp;gt;[^\&amp;lt;]+)"&amp;nbsp;&lt;BR /&gt;| rex "\"SubjectUserName\"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)"&lt;BR /&gt;| rex "\"ObjectType\"&amp;gt;(?&amp;lt;ObjectType&amp;gt;[^\&amp;lt;]+)"&lt;/P&gt;&lt;P&gt;I'd like to have these fields created so that the rex statements are not necessary. If using EXTRACT-fields is the best method for this, what should the configuration look like for these fields?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 17:44:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639971#M221763</guid>
      <dc:creator>hawkik1</dc:creator>
      <dc:date>2023-04-14T17:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a regex to work in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639974#M221765</link>
      <description>&lt;P&gt;XML:&lt;/P&gt;&lt;P&gt;"" &amp;lt;Data Name="SubjectDomainName"&amp;gt;US&amp;lt;/Data&amp;gt;&amp;lt;Data Name="SubjectUserName"&amp;gt;fmtdc&amp;lt;/Data&amp;gt;&amp;lt;Data Name="ObjectServer"&amp;gt;Security&amp;lt;/Data&amp;gt;&amp;lt;Data Name="ObjectType"&amp;gt;File&amp;lt;/Data&amp;gt; ""&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 17:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639974#M221765</guid>
      <dc:creator>hawkik1</dc:creator>
      <dc:date>2023-04-14T17:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a regex to work in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639987#M221769</link>
      <description>&lt;P&gt;If you want to extract all of the XML fields then use KV_MODE = xml in props.conf.&amp;nbsp; To extract selected fields then (IMO) EXTRACT is the way.&amp;nbsp; Use your existing regular expressions, modified as I described in my previous answer.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EXTRACT-SystemTime = SystemTime="(?&amp;lt;SystemTime&amp;gt;[^"]+)
EXTRACT-SubjectDomainName = SubjectDomainName"&amp;gt;(?&amp;lt;Domain&amp;gt;[^\&amp;lt;]+)
EXTRACT-SubjectUserName = SubjectUserName"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)
EXTRACT-ObjectType = ObjectType"&amp;gt;(?&amp;lt;ObjectType&amp;gt;[^\&amp;lt;]+)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 18:51:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639987#M221769</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-04-14T18:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a regex to work in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639992#M221774</link>
      <description>&lt;P&gt;&lt;SPAN&gt;[Username]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;REGEX = \"SubjectUserName\"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 19:00:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/639992#M221774</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-04-14T19:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a regex to work in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/640019#M221781</link>
      <description>&lt;P&gt;I'm still doing something incorrect.&amp;nbsp; I'm editing&amp;nbsp;/opt/splunk/etc/apps/Splunk_TA_nix/local/props.conf on my standalone enterprise server.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added this at the bottom of the file. Sourcetype of the search is fileshares:&lt;/P&gt;&lt;P&gt;[fileshares]&lt;BR /&gt;EXTRACT-SystemTime = SystemTime="(?&amp;lt;SystemTime&amp;gt;[^"]+)&lt;BR /&gt;EXTRACT-SubjectDomainName = SubjectDomainName"&amp;gt;(?&amp;lt;Domain&amp;gt;[^\&amp;lt;]+)&lt;BR /&gt;EXTRACT-SubjectUserName = SubjectUserName"&amp;gt;(?&amp;lt;Username&amp;gt;[^\&amp;lt;]+)&lt;BR /&gt;EXTRACT-ObjectType = ObjectType"&amp;gt;(?&amp;lt;ObjectType&amp;gt;[^\&amp;lt;]+)&lt;/P&gt;&lt;P&gt;I also tried this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;[fileshares]&lt;BR /&gt;KV_MODE=xml&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Restarted splunk and neither of the above worked. Using |xmlkv works fine btw, but grabs way too many fields, slowing the search. Thanks ahead of time from the newbe.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 21:09:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-regex-to-work-in-transforms-conf/m-p/640019#M221781</guid>
      <dc:creator>hawkik1</dc:creator>
      <dc:date>2023-04-14T21:09:05Z</dc:date>
    </item>
  </channel>
</rss>

