Getting Data In

parsing specific area of a field

angelboshnakov
New Member

Hello all,

just wondering if it is possible and how to do the following search?

Got a field with URLs ( for example: /v0.1/first/second/third?= ) and a field with IPs that have hit each URL.

ex:
"URL /v0.1/first/second/third=12 IP: 10.10.10.10 "
"URL /v0.1/first/second/third=123 IP: 11.11.11.11 "
"URL /v0.1/first/second/third=1234 IP: 12.12.12.12"
"URL /v0.1/first/second/123 IP: 13.13.13.13 "
"URL /v0.1/first/1234 IP: 13.13.13.13"

How should I make my search in order to:

match and count the number of hits per IP against each URL (the tricky part: by parsing and counting the URLs in total /v0.1/first/ without the rest of the URL) to get total count of hits per all URLs, per minute, per hour and per IP)

It's not definitely all of this to be in one search ( one for total counts, one for per minute etc )

so far I've come with:

source="....." | stats dc(URL) as count by URL,IP | sort -count
and it shows me a field with URLs, IP, and count of URL<->IP hits

yep.. I know.. splunk noob here

Any ideas will be much appreciated 🙂

0 Karma

woodcock
Esteemed Legend

I do not understand what you mean but I think that this should give you more than you need:

... | rex field=URL "^(?<URL3segments>(?:[^/]/){3})" | stats count as hits dc(URL) values(URL) dc(IP) values(IP) by URL3segments
0 Karma

rphillips_splk
Splunk Employee
Splunk Employee

it sounds like you want to extract a portion of the URL into its own field correct?
/v0.1/first

0 Karma

somesoni2
Revered Legend

Is there any specific rule that can be set here about URL portion to be counted, only the first Two segments to be counted?

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...