Hi Splunkers,
I need some help with a regex/command to extract the file name from the file path :
Actually I have the EVAL command in my props.conf :
The EVAL command working fine for most of the paths. But sometimes, the path is not common and contains parentheses and backslashs after the file_name value...
This is some examples of unusual paths I encountered (what I want to extract is in bold) :
With my actual configuration I extract only the value after the last "\\" of the line...
Could you help me to construct that regex/command to be able to exctract the right values ?
Thanks
Hi @kvnpichon,
Please try below in your props;
props.conf
REPORT-file_name=file_name_extract
transforms.conf
[file_name_extract]
SOURCE_KEY= filePath
REGEX= "\\\\(?<file_name>[A-Za-z0-9\._\[\]-]+\.(?:exe|zip))(?:\s|\()"
FORMAT = file_name::$1
Hi,
I tried to add your line in my props.conf file but the file_name isn't extracted as expected.
trim(mvindex(split(mvindex(split(filePath,"("),0),"\\"),-1))