Splunk Search

"Unknown country" returned by iplocation? bug?

boris
Path Finder

iplocation bug?

"UNKNOWN COUNTRY" is returned for ip addresses that actually have a known country?

USA
208.65.40.98
89.68.157.6 
112.199.36.74 
173.8.207.161

UK
94.193.166.5

Brazil
189.68.157.6
189.28.128.241

Tags (1)
0 Karma
1 Solution

Damien_Dallimor
Ultra Champion

Not a direct bug with the iplocation command per say , but the service that the command's script ($SPLUNK_HOME/etc/apps/search/bin/iplocation.py) uses does not return any results.

http://www.hostip.info most probably need to update their database.

Using the 208.65.40.98 IP as an example :

REQUEST

http://api.hostip.info/get_html.php?ip=208.65.40.98

RESPONSE

Country: (Unknown Country?) (XX)
City: (Unknown City?)
IP: 208.65.40.98

Alternatively , I tried performing geolocation on that IP using the MAXMIND GeoLite City database that comes with the Splunk Google Maps App, and it resolves "United States" just fine.

Hacky little test command :

... | eval ip="208.65.40.98" | lookup geo ip | table ip_country_name

or

... | eval ip="208.65.40.98" | geoip ip | table ip_country_name

View solution in original post

Jason
Motivator

Note that this is pre-6.x iplocation. There is no more iplocation.py as of 6, as it is replaced by a built-in command that has a databased updated with maintenance releases http://answers.splunk.com/answers/123430/how-to-update-geoip-database-for-iplocation-command

0 Karma

Damien_Dallimor
Ultra Champion

Not a direct bug with the iplocation command per say , but the service that the command's script ($SPLUNK_HOME/etc/apps/search/bin/iplocation.py) uses does not return any results.

http://www.hostip.info most probably need to update their database.

Using the 208.65.40.98 IP as an example :

REQUEST

http://api.hostip.info/get_html.php?ip=208.65.40.98

RESPONSE

Country: (Unknown Country?) (XX)
City: (Unknown City?)
IP: 208.65.40.98

Alternatively , I tried performing geolocation on that IP using the MAXMIND GeoLite City database that comes with the Splunk Google Maps App, and it resolves "United States" just fine.

Hacky little test command :

... | eval ip="208.65.40.98" | lookup geo ip | table ip_country_name

or

... | eval ip="208.65.40.98" | geoip ip | table ip_country_name

Damien_Dallimor
Ultra Champion

You could use either the geoip command or the lookup command against the geo lookup.

0 Karma

boris
Path Finder

Damiean's intended test:

| eval some_ip="208.65.40.98" | geoip some_ip | table some_ip_country_name
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...