Splunk Search

How to extract a URL between two strings ?

maramk
Explorer

Hi,

   I am a have content like below and i would like to extract git url from it. Please suggest me how to do it using rex?

 

Content:

  proj_url\x1B[0;m=https://my.test.net/sample/test.git test\x1B[0;m=abcd.

Output should be: https://my.test.net/sample/test.git

 

Any help is appreciated.

 

Thanks.

Labels (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try this

..| rex "(?<URL>http\S+)"

  OR

...| rex "x1B\[0\;m\=(?<URL>\S+)"

View solution in original post

maramk
Explorer

first query worked. Thank you

0 Karma

somesoni2
Revered Legend

Try this

..| rex "(?<URL>http\S+)"

  OR

...| rex "x1B\[0\;m\=(?<URL>\S+)"
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...