Splunk Search

Problem with iplocation showing multiple City and Country fields

pstutz
Explorer

I'm getting unusual results when invoking the iplocation command (listed below). When the table is displayed it marks all results as Private IP space. However in the "other interesting fields" side bar I see multiple City/Country values with an interger appended. For example Country3 with 2 countries (Finland and United States). How can I correct the results of iplocation so that it consolidates City and Country into their respective fields?

Query:

sourcetype="pfsense_pf" fw_action="block" AND interface="vr1" | iplocation | table src_ip, City, Country

Results:

1   73.98.34.1  (Private Address)   (Private Address) (XX)
2   73.98.34.1  (Private Address)   (Private Address) (XX)
3   73.98.34.1  (Private Address)   (Private Address) (XX)
4   73.98.34.1  (Private Address)   (Private Address) (XX)
5   73.98.34.1  (Private Address)   (Private Address) (XX)
6   73.98.34.1  (Private Address)   (Private Address) (XX)
7   73.98.34.1  (Private Address)   (Private Address) (XX)
8   73.98.34.1  (Private Address)   (Private Address) (XX)
9   73.98.34.1  (Private Address)   (Private Address) (XX)
10  73.98.34.1  (Private Address)   (Private Address) (XX)

Other interesting fields (42)
City (1)
City1 (1)
City2 (1)
City3 (2)
City4 (1)
City5 (6)
City6 (1)
City7 (3)
City8 (1)
Country (1)
Country1 (1)
Country2 (1)
Country3 (2)
Country4 (1)
Country5 (2)
Country6 (1)
Country7 (2)
Country8 (1)
Tags (1)
0 Karma

lguinn2
Legend

iplocation is actually a Python script. So you could make a custom version of the script, and have it return the results in a different way.

There is more info in some of the other answers (such as this one) and in the Developer Manual

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...