Splunk Search

How to extract the last file name from my sample string of data?

jclemons7
Path Finder

Hello all,

I have the following string:

"6900   0   1024        0   0   0   0   0   0   0   C:\windows\System32\Launcher.exe    "C:\windows\System32\Launcher.exe" "C:\Folder\Link - Shortcut.lnk"  ",

And I need a way to get the very last part (e.g.. Shortcut.lnk). Normally I would use regex for this in SQL or code, but for the life of me, I can't figure out how to implement it in Splunk.

Any help is greatly appreciated..

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Splunk does regex, too. Assuming your text is already extracted, this should pull out the last part. I've made other assumptions about the characters that start and end the desired text so you may need to adjust the regex.

... | rex field=text "- (?<shortcut>[^\"]*)" | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma

bmacias84
Champion

Can you provide a few more samples?

0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...