<?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: Get filename from path with rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658315#M227400</link>
    <description>&lt;P&gt;Since the Image field does not contain the string "Executable=" the regular expression does not match and &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; extracts nothing.&amp;nbsp; Try removing "Executable=" from the command.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2023 15:55:25 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-09-21T15:55:25Z</dc:date>
    <item>
      <title>Get filename from path with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658296#M227394</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;&lt;BR /&gt;I am trying to get filename (name.exe) from a full path (dir + filename) from windows folders, ex:&lt;BR /&gt;&lt;BR /&gt;C:\dir1\dir2\filename.ext&lt;BR /&gt;&lt;BR /&gt;using code as below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = os_sysmon NOT Image="*Sysmon*" EventCode=1
| rex field=Image "Executable=(?P&amp;lt;Executable&amp;gt;[^\\\]+)$"
| table Image Executable&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Problem:&lt;BR /&gt;Executable always empty&lt;BR /&gt;&lt;BR /&gt;Can you please advise?&lt;BR /&gt;&lt;BR /&gt;best regards&lt;BR /&gt;Altin&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 14:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658296#M227394</guid>
      <dc:creator>altink</dc:creator>
      <dc:date>2023-09-21T14:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get filename from path with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658298#M227396</link>
      <description>&lt;P&gt;The regular expression shown could be good, but we can't tell without seeing a sample event (not just a file path).&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 14:10:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658298#M227396</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-21T14:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get filename from path with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658303#M227398</link>
      <description>&lt;P&gt;thank you &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp; for the reply&lt;BR /&gt;&lt;BR /&gt;attached is an example of my search&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rex_issue_01.jpg" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27265i744DC466FF1C1BE0/image-size/large?v=v2&amp;amp;px=999" role="button" title="rex_issue_01.jpg" alt="rex_issue_01.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 14:23:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658303#M227398</guid>
      <dc:creator>altink</dc:creator>
      <dc:date>2023-09-21T14:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Get filename from path with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658315#M227400</link>
      <description>&lt;P&gt;Since the Image field does not contain the string "Executable=" the regular expression does not match and &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; extracts nothing.&amp;nbsp; Try removing "Executable=" from the command.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658315#M227400</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-21T15:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get filename from path with rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658318#M227402</link>
      <description>&lt;P&gt;Thank You very much &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;As You suggested, the following worked:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = os_sysmon NOT Image="*Sysmon*" EventCode=1
| rex field=Image "(?P&amp;lt;Executable&amp;gt;[^\\\]+)$"
| table Image Executable&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 21 Sep 2023 16:17:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-filename-from-path-with-rex/m-p/658318#M227402</guid>
      <dc:creator>altink</dc:creator>
      <dc:date>2023-09-21T16:17:59Z</dc:date>
    </item>
  </channel>
</rss>

