Splunk Search

field extraction

splunklearner
Communicator

Hi, 

Please extract DUSTER and JUNIPER as app_name from following sample events - 

1. unit_hostname="GBWDC111AD011HMA.systems.uk.fed"

support_id="16675049156208762610"

vs_name="/f5-tenant-01/DUSTER-GBM-FR-DEV/v-dusteruat.systems.uk.fed-443"

policy_name="/Common/waf-fed-transparent

 

2. unit_hostname="GBWDC111AD011HMA.systems.uk.fed"

support_id="16675049156208762610"

vs_name="/f5-tenant-01/JUNIPER-GBM-FR-DEV/v-juniperuat.systems.uk.fed-443"

policy_name="/Common/waf-fed-transparent

 

The app_names will be dynamic and there is no gurantee that everytime GBM will not be coming beside app_names.

I tried this - vs_name=\"\/.*\/(?<app_name>.*)\-GBM

but as I told everytime GBM will not same in all events. Please make it generic and give the regex for me. Thanks

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Regular expressions work on pattern matching and two examples is not many to secure a reliable pattern, that being said, if your data has already been extracted into the vs_name field, you could try something like this

| rex field=vs_name "^\/[^\/]+\/(?<app_name>\w+)\-"

View solution in original post

0 Karma

kiran_panchavat
Influencer

@splunklearner Please check this

| makeresults count=2 
| eval vs_name1="/f5-tenant-01/DUSTER-GBM-FR-DEV/v-dusteruat.systems.uk.fed-443"
| eval vs_name2="/f5-tenant-01/JUNIPER-GBM-FR-DEV/v-juniperuat.systems.uk.fed-443"
| eval vs_name=mvappend(vs_name1, vs_name2)
| mvexpand vs_name
| rex field=vs_name "\/[^\/]+\/(?<app_name>[^\/\-]+)"
| table vs_name, app_name

kiran_panchavat_0-1738745483721.png

 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Regular expressions work on pattern matching and two examples is not many to secure a reliable pattern, that being said, if your data has already been extracted into the vs_name field, you could try something like this

| rex field=vs_name "^\/[^\/]+\/(?<app_name>\w+)\-"
0 Karma
Get Updates on the Splunk Community!

Best Strategies to Optimize Observability Costs

 Join us on Tuesday, May 6, 2025, at 11 AM PDT / 2 PM EDT for an insightful session on optimizing ...

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...