<?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: Using Rex to pull out a file path , file name and extension from verbose message field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538946#M152408</link>
    <description>&lt;P&gt;Works a charm! thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 08 Feb 2021 09:11:49 GMT</pubDate>
    <dc:creator>ViperV</dc:creator>
    <dc:date>2021-02-08T09:11:49Z</dc:date>
    <item>
      <title>Using Rex to pull out a file path , file name and extension from verbose message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538922#M152402</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to splunk searches and would appreciate some help to find out how to pull out the file path, file name and file extension from the message field(example below)&lt;/P&gt;&lt;P&gt;The message has verbose text and the path occurs twice within the text. In this example I'd be looking to extract from within the text &lt;SPAN class="t"&gt;the file path, file name and file extension and present them in a four column table along with the the time of the event.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;Thanks in advance! &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="137px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="643px"&gt;&lt;DIV class="shared-eventsviewer-shared-rawfield"&gt;&lt;DIV class="json-event  wrap "&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="raw-event normal  wrap "&gt;&lt;SPAN class="t"&gt;Message=Code&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Integrity&lt;/SPAN&gt; &lt;SPAN class="t"&gt;determined&lt;/SPAN&gt; &lt;SPAN class="t"&gt;that&lt;/SPAN&gt; &lt;SPAN class="t"&gt;a&lt;/SPAN&gt; &lt;SPAN class="t"&gt;process&lt;/SPAN&gt; (&lt;SPAN class="t"&gt;\Device\HarddiskVolume1\Program&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Files\SplunkUniversalForwarder\bin\splunkd.exe&lt;/SPAN&gt;) &lt;SPAN class="t"&gt;attempted&lt;/SPAN&gt; &lt;SPAN class="t"&gt;to&lt;/SPAN&gt; &lt;SPAN class="t"&gt;load&lt;/SPAN&gt; &lt;SPAN class="t"&gt;\Device\HarddiskVolume1\Program&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Files\SplunkUniversalForwarder\bin\splunk-netmon.exe&lt;/SPAN&gt; &lt;SPAN class="t"&gt;that&lt;/SPAN&gt; &lt;SPAN class="t"&gt;did&lt;/SPAN&gt; &lt;SPAN class="t"&gt;not&lt;/SPAN&gt; &lt;SPAN class="t"&gt;meet&lt;/SPAN&gt; &lt;SPAN class="t"&gt;the&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Enterprise&lt;/SPAN&gt; &lt;SPAN class="t"&gt;signing&lt;/SPAN&gt; &lt;SPAN class="t"&gt;level&lt;/SPAN&gt; &lt;SPAN class="t"&gt;requirements&lt;/SPAN&gt; &lt;SPAN class="t"&gt;or&lt;/SPAN&gt; &lt;SPAN class="t h"&gt;violated&lt;/SPAN&gt; &lt;SPAN class="t a"&gt;&lt;SPAN class="t"&gt;code&lt;/SPAN&gt; &lt;SPAN class="t"&gt;integrity&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="t"&gt;policy&lt;/SPAN&gt; (&lt;SPAN class="t"&gt;Policy&lt;/SPAN&gt; &lt;SPAN class="t"&gt;ID:&lt;/SPAN&gt;{&lt;SPAN class="t"&gt;a244370e-44c9-4c06-b551-f6016e563076&lt;/SPAN&gt;})&lt;SPAN class="t"&gt;.&lt;/SPAN&gt; &lt;SPAN class="t"&gt;However&lt;/SPAN&gt;, &lt;SPAN class="t"&gt;due&lt;/SPAN&gt; &lt;SPAN class="t"&gt;to&lt;/SPAN&gt; &lt;SPAN class="t a"&gt;&lt;SPAN class="t"&gt;code&lt;/SPAN&gt; &lt;SPAN class="t"&gt;integrity&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="t"&gt;auditing&lt;/SPAN&gt; &lt;SPAN class="t"&gt;policy&lt;/SPAN&gt;, &lt;SPAN class="t"&gt;the&lt;/SPAN&gt; &lt;SPAN class="t"&gt;image&lt;/SPAN&gt; &lt;SPAN class="t"&gt;was&lt;/SPAN&gt; &lt;SPAN class="t"&gt;allowed&lt;/SPAN&gt; &lt;SPAN class="t"&gt;to&lt;/SPAN&gt; &lt;SPAN class="t"&gt;load.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="raw-event normal  wrap "&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 08 Feb 2021 07:08:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538922#M152402</guid>
      <dc:creator>ViperV</dc:creator>
      <dc:date>2021-02-08T07:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to pull out a file path , file name and extension from verbose message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538927#M152403</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231306"&gt;@ViperV&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I didn't undestand if you need to extract the first path or the second.&lt;/P&gt;&lt;P&gt;Anyway, the first extraction is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\((?&amp;lt;path&amp;gt;\\.*\\bin\\)(?&amp;lt;file&amp;gt;[^\.]+)\.(?&amp;lt;ext&amp;gt;\w+)\)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/DN7taY/1" target="_blank"&gt;https://regex101.com/r/DN7taY/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;the second one is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\s(?&amp;lt;path&amp;gt;\\.*\\bin\\)(?&amp;lt;file&amp;gt;[^\.]+)\.(?&amp;lt;ext&amp;gt;\w+)\s"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;\s(?&amp;lt;path&amp;gt;\\.*\\bin\\)(?&amp;lt;file&amp;gt;[^\.]+)\.(?&amp;lt;ext&amp;gt;\w+)\s&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 07:37:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538927#M152403</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-08T07:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to pull out a file path , file name and extension from verbose message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538938#M152404</link>
      <description>&lt;P&gt;Grazie Giuseppe!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the following error on trying the code&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error in 'rex' command: Encountered the following error while compiling the regex '\s(?&amp;lt;path&amp;gt;\.*\bin\)(?&amp;lt;file&amp;gt;[^\.]+)\.(?&amp;lt;ext&amp;gt;\w+)\s': Regex: missing closing parenthesis.&lt;/LI-CODE&gt;&lt;P&gt;should i be closing it with an extra parenthesis?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i guess to create a table i do the following?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...|table path, file, ext&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 08:22:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538938#M152404</guid>
      <dc:creator>ViperV</dc:creator>
      <dc:date>2021-02-08T08:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to pull out a file path , file name and extension from verbose message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538940#M152405</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231306"&gt;@ViperV&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;beware: that are two backslashes three times in the first part of the regex, not one:&lt;/P&gt;&lt;P&gt;| rex "\s(?&amp;lt;path&amp;gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;U&gt;\\&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;.*&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;U&gt;\\&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;bin&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;U&gt;\\&lt;/U&gt;&lt;/STRONG&gt;&lt;/FONT&gt;)(?&amp;lt;file&amp;gt;[^\.]+)\.(?&amp;lt;ext&amp;gt;\w+)\s"&lt;/P&gt;&lt;P&gt;because you have backslash in your path but backslash is a special char in regexes that must be escaped with another backslash.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 08:30:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538940#M152405</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-08T08:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to pull out a file path , file name and extension from verbose message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538941#M152406</link>
      <description>&lt;P&gt;Great, thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would that also work for the following type of path?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(\Device\HarddiskVolume1\Windows\explorer.exe) attempted to load \Device\HarddiskVolume1\Users\vagrant\Downloads\kitty-0.74.4.6.exe &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Feb 2021 08:42:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538941#M152406</guid>
      <dc:creator>ViperV</dc:creator>
      <dc:date>2021-02-08T08:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to pull out a file path , file name and extension from verbose message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538945#M152407</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231306"&gt;@ViperV&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you have to use a different regex for a di fferent log:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\((?&amp;lt;path&amp;gt;\\.+)\\(?&amp;lt;file&amp;gt;[^\.]+)\.(?&amp;lt;ext&amp;gt;[^\)]+)\)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/ZJ0Fyv/1" target="_blank"&gt;https://regex101.com/r/ZJ0Fyv/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or the second:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\s(?&amp;lt;path&amp;gt;\\.+)\\(?&amp;lt;file&amp;gt;.+)\.(?&amp;lt;ext&amp;gt;[^\)]+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/ZJ0Fyv/1" target="_blank"&gt;https://regex101.com/r/ZJ0Fyv/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If this answer solves your need, please accept it for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao.&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, 08 Feb 2021 09:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538945#M152407</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-08T09:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Rex to pull out a file path , file name and extension from verbose message field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538946#M152408</link>
      <description>&lt;P&gt;Works a charm! thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 09:11:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Rex-to-pull-out-a-file-path-file-name-and-extension-from/m-p/538946#M152408</guid>
      <dc:creator>ViperV</dc:creator>
      <dc:date>2021-02-08T09:11:49Z</dc:date>
    </item>
  </channel>
</rss>

