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!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...