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!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...