Using Geo Location Lookup Script

The Geo Location Lookup Script is a lookup script used to provide geolocation information for IP addresses. Looking at the documentation, we see this example:

eventtype=firewall_event | lookup geoip clientip as src_ip 

You can find the documentation for any Splunkbase app by searching for it at https://splunkbase.com, or by clicking on View details on Splunk apps (next to any installed app), clicking on Apps, and viewing the Apps page.

Let's go through the arguments of the lookup command:

Included in the ImplementingSplunkDataGenerator app (available at http://packtpub.com/support) is a sourcetype instance named impl_splunk_ips, which looks like this:

2012-05-26T18:23:44 ip=64.134.155.137 

The IP addresses in this fictitious log are from one of my websites. Let's see some information about these addresses:

sourcetype="impl_splunk_ips" | lookup geoip clientip AS ip | top 
client_country

This gives us a table similar to the one shown in the following screenshot (note that after running the command, new fields are added, such as client_country):

That's interesting. I wonder who is visiting my site from Slovenia.