Splunk Search

extract names from URL using regex

anooshac
Communicator

Hello all,

I haven't used rex many times.

I have a URL like this, http;s://ab-abcd.in.xyz.com/abcd_xyz/job/example_name/" .

Here ab-abcd.in.xyz.com is server name, abcd_xyz is project name and example_name is task name.

I have to extract these using regex. I have tried using this query,

|rex field=URL "https:\//(?<server_name>\w*)/\(?<project_name>\w*)\/job\/(?<task_name>\w*)\/"| table server_name project_name task_name

I know that this query is wrong.But confused on how to correct it.  Can anyone help me to correct this query.

Labels (2)
Tags (3)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Try this

| rex field=URL "https://(?<server_name>[^/]*)/(?<project_name>[^/]*)/job/(?<task_name>[^/]*)" 

View solution in original post

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Try this

| rex field=URL "https://(?<server_name>[^/]*)/(?<project_name>[^/]*)/job/(?<task_name>[^/]*)" 
0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Cultivate Your Career Growth with Fresh Splunk Training

Growth doesn’t just happen—it’s nurtured. Like tending a garden, developing your Splunk skills takes the right ...

Introducing a Smarter Way to Discover Apps on Splunkbase

We’re excited to announce the launch of a foundational enhancement to Splunkbase: App Tiering.  Because we’ve ...