Splunk Search

rex regex to extract first folder name from the path

sim_tcr
Communicator

Hello,

My source filed has value such as,

*/icsws/log/INSTANCE1/was/base/icsws_ca_server/SystemOut.log*
/icsws*/log/INSTANCE1/ihs/access_log
/wcics
/log/INSTANCE1/ihs/access_log
...
...
*

I would like to extract the first folder names (icsws*, wcics) from above to field named VAH.
can someone help me complete *
| rex field=source ".."**

Thanks,
Simon Mandy

Tags (2)
0 Karma
1 Solution

javiergn
Super Champion

Try this:

| rex field=source "^/(?<first_folder>[^/]+)"

View solution in original post

0 Karma

javiergn
Super Champion

Try this:

| rex field=source "^/(?<first_folder>[^/]+)"
0 Karma
Get Updates on the Splunk Community!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...