Splunk Search

creating field for url

labani
Explorer

How can I create a field for url? I am unable to do it by field extraction.

Tags (1)
0 Karma
1 Solution

MHibbin
Influencer

I think the regular expression you are looking for is:

\w+\:\/\/[^\s]+

EDIT: Probably get away with using the following, however I have a habit of escaping the characters:

\w+://[^\s]+

You can test this using the rex command, like:

<yourBaseSearch> | rex field=_raw "(?P<url>\w+\:\/\/[^\s]+)" | table _time url _raw

(Don't really need the table part, just makes it easier to match it up).

Once you have your regular expression correct, you can just paste that into the IFX (Interactive Field eXtractor).

Additionally, for testing regular expressions, the following site is very helpful:

http://gskinner.com/RegExr/

Hope this helps.

View solution in original post

MHibbin
Influencer

I think the regular expression you are looking for is:

\w+\:\/\/[^\s]+

EDIT: Probably get away with using the following, however I have a habit of escaping the characters:

\w+://[^\s]+

You can test this using the rex command, like:

<yourBaseSearch> | rex field=_raw "(?P<url>\w+\:\/\/[^\s]+)" | table _time url _raw

(Don't really need the table part, just makes it easier to match it up).

Once you have your regular expression correct, you can just paste that into the IFX (Interactive Field eXtractor).

Additionally, for testing regular expressions, the following site is very helpful:

http://gskinner.com/RegExr/

Hope this helps.

MHibbin
Influencer

Credit goes to @Drainy as he showed me gskinner aaaaaages ago.

0 Karma

MuS
Legend

gskinner is truly one of the best online regex testing tools [^]

0 Karma

labani
Explorer

2013 Jun 22 09:33:40 tracker1 httpproxy_access[41545]: 10.10.34.17 3398 TCP_MISS/200 0 NONHTTP binary://217.212.238.41:80 - DIRECT/217.212.238.41 - [acl=nonhttp] [cat=-] [err=-]
i have log like this. i want to extract url field. thank you

0 Karma

MuS
Legend

like nr.5 said: need more input
please provide more detailed information about what you want to achieve and provide some example log data - thanks

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...

Index This | How many sevens are there between 1 and 100?

August 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...