- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello
I am trying to get filename (name.exe) from a full path (dir + filename) from windows folders, ex:
C:\dir1\dir2\filename.ext
using code as below:
index = os_sysmon NOT Image="*Sysmon*" EventCode=1
| rex field=Image "Executable=(?P<Executable>[^\\\]+)$"
| table Image Executable
Problem:
Executable always empty
Can you please advise?
best regards
Altin
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


Since the Image field does not contain the string "Executable=" the regular expression does not match and rex extracts nothing. Try removing "Executable=" from the command.
If this reply helps you, Karma would be appreciated.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


The regular expression shown could be good, but we can't tell without seeing a sample event (not just a file path).
If this reply helps you, Karma would be appreciated.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

thank you @richgalloway for the reply
attached is an example of my search
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


Since the Image field does not contain the string "Executable=" the regular expression does not match and rex extracts nothing. Try removing "Executable=" from the command.
If this reply helps you, Karma would be appreciated.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thank You very much @richgalloway
As You suggested, the following worked:
index = os_sysmon NOT Image="*Sysmon*" EventCode=1
| rex field=Image "(?P<Executable>[^\\\]+)$"
| table Image Executable
