<?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: Splunk rex help: regex for windows and unix path in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472282#M132891</link>
    <description>&lt;P&gt;Keep it simple!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=full_log "^full_log:\sFile\s'(?&amp;lt;filename&amp;gt;[^']+)'\schecksum changed\."
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Rather than trying to guess all legal characters, why not just tell rex "anything but a single quote" ?&lt;/P&gt;

&lt;P&gt;This strategy will save you a lot of time, improve readability, and make your extractions much more durable.&lt;/P&gt;

&lt;P&gt;See regex: &lt;A href="https://regex101.com/r/iz1eYY/1"&gt;https://regex101.com/r/iz1eYY/1&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2019 16:59:28 GMT</pubDate>
    <dc:creator>jpolvino</dc:creator>
    <dc:date>2019-11-22T16:59:28Z</dc:date>
    <item>
      <title>Splunk rex help: regex for windows and unix path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472278#M132887</link>
      <description>&lt;P&gt;Hi, I am a newbie to SPL. I am trying to write a regex that will extract the unix/windows path from the full_log field. I am having no luck with that. Can you please help? The following regex is for Windows. Thank you for your help. &lt;BR /&gt;
HB&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="newindx" agent.name="*-svrname-*" "*checksum*" | rex field=full_log "^File\s+(?&amp;lt;checksum_changed&amp;gt;^\'[a-zA-Z]:\\[\\\S|*\S]?.*'$)\s+checksum\s+changed.+"

full_log: File '/apps/data/db.data' checksum changed.
full_log: File 'c:\windows\system32\xpsservices.dll' checksum changed.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2019 02:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472278#M132887</guid>
      <dc:creator>hbustam8063</dc:creator>
      <dc:date>2019-10-31T02:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rex help: regex for windows and unix path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472279#M132888</link>
      <description>&lt;P&gt;Try &lt;CODE&gt;... | rex field=full_log "File '(?&amp;lt;path&amp;gt;.*)[\\\/]\w+\.\w+'"&lt;/CODE&gt;.  If that doesn't work, you may need more escape characters so try &lt;CODE&gt;...| rex field=full_log "File '(?&amp;lt;path&amp;gt;.*)[\\\\\/]\w+\.\w+'"&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 02:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472279#M132888</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-10-31T02:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rex help: regex for windows and unix path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472280#M132889</link>
      <description>&lt;P&gt;@hbustam8063 &lt;/P&gt;

&lt;P&gt;You can also use this. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|rex " ( full_log: File\s\')(?&amp;lt;Path&amp;gt;(.*)+)[\/\\]\w+\.\w+'"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and to check your rex :- &lt;CODE&gt;&lt;A href="https://rubular.com/r/M2QDmpGvQr0Yts" target="test_blank"&gt;https://rubular.com/r/M2QDmpGvQr0Yts&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 05:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472280#M132889</guid>
      <dc:creator>vikcee</dc:creator>
      <dc:date>2019-10-31T05:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rex help: regex for windows and unix path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472281#M132890</link>
      <description>&lt;P&gt;Here is my attempt...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=full_log "File\s\'(?&amp;lt;pathname&amp;gt;.+[\/\\])[^\\\/]+\'\schecksum\schanged\."
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/87ro6z/1"&gt;https://regex101.com/r/87ro6z/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 16:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472281#M132890</guid>
      <dc:creator>darrenfuller</dc:creator>
      <dc:date>2019-11-19T16:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rex help: regex for windows and unix path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472282#M132891</link>
      <description>&lt;P&gt;Keep it simple!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=full_log "^full_log:\sFile\s'(?&amp;lt;filename&amp;gt;[^']+)'\schecksum changed\."
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Rather than trying to guess all legal characters, why not just tell rex "anything but a single quote" ?&lt;/P&gt;

&lt;P&gt;This strategy will save you a lot of time, improve readability, and make your extractions much more durable.&lt;/P&gt;

&lt;P&gt;See regex: &lt;A href="https://regex101.com/r/iz1eYY/1"&gt;https://regex101.com/r/iz1eYY/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 16:59:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472282#M132891</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-11-22T16:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk rex help: regex for windows and unix path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472283#M132892</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=full_log "'(?&amp;lt;NewFieldNameHere&amp;gt;[^']+)'"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2019 17:08:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-rex-help-regex-for-windows-and-unix-path/m-p/472283#M132892</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-22T17:08:29Z</dc:date>
    </item>
  </channel>
</rss>

