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!

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...

Adoption of Infrastructure Monitoring at Splunk

  Splunk's Growth Engineering team showcases one of their first Splunk product adoption-Splunk Infrastructure ...