Splunk Search

How to get a Stats count of field values by country

Hildoceras
New Member

Hi

I am looking at access log data with the fields src_ip and method (get, post, head)

I have been running the search src_ip="*" | iplocation src_ip | stats count by country

this gives me an event count by country.

I would like to take this further and also get a count of total events by country and a split per country of get, post and head

any help appreciated

Tags (1)
0 Karma

MuS
Legend

Hi Hildoceras,

something like this should get you there:

 ... | stats count(eval(method="POST")) AS post count(eval(method="GET")) AS get count(eval(method="HEAD")) AS head by country | addtotals 

hope this helps ...

cheers, MuS

MuS
Legend

feel free to accept the answer, thanks 😉

0 Karma

Hildoceras
New Member

Worked like a charm many thanks

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...