icon/x Created with Sketch.

Splunk Cookie Policy

We use our own and third-party cookies to provide you with a great online experience. We also use these cookies to improve our products and services, support our marketing campaigns, and advertise to you on our website and other websites. Some cookies may continue to collect information after you have left our website. Learn more (including how to update your settings) here.
Accept Cookie Policy

We are working on something new...

A Fresh New Splunkbase
We are designing a New Splunkbase to improve search and discoverability of apps. Check out our new and improved features like Categories and Collections. New Splunkbase is currently in preview mode, as it is under active development. We welcome you to navigate New Splunkbase and give us feedback.

Accept License Agreements

This app is provided by a third party and your right to use the app is in accordance with the license provided by that third-party licensor. Splunk is not responsible for any third-party apps and does not provide any warranty or support. If you have any questions, complaints or claims with respect to this app, please contact the licensor directly.

Thank You

Downloading Google GeoCode
SHA256 checksum (google-geocode_171.tgz) d27f7678020ba1d9060883906fcd3c12cf8da52ca3213e735cc28c580454de5e SHA256 checksum (google-geocode_160.tgz) abd85faffbc2c5039d0d36b19a5b07d6767f7b5315eb07f70bc3b93410988773 SHA256 checksum (google-geocode_16.tgz) 90266e1df848eb54240ba6ef305b8169d56d2d4b9de0051c0486ba20cec8af35 SHA256 checksum (google-geocode_15.tgz) 53950c5b4968ca1101e7b1aa65b8abf7d643564f4ca4103d29240346a26b0cca SHA256 checksum (google-geocode_14.tgz) 61129e37586a7f12235270f95a03df8712ea4ff57f19692ef3b30e1cd7346ffc SHA256 checksum (google-geocode_13.tgz) 6cf5300d6cfa94837148f9cfb7a5437ebf963074a1be0cb617744bd9693223e6 SHA256 checksum (google-geocode_12.tgz) 5dc34f1edc7b6331cfd486f982dd23d436252b4a06e083c80a214c6868397f73 SHA256 checksum (google-geocode_11.tgz) efdc959bf8d464d2319602731add61d9f45ce00edf8bc0e3c5a31d88c4b8fa98 SHA256 checksum (google-geocode_10.tgz) e15e775ccc125f44caa1aa048579b162a4fee1e6a29d56e0892945a01a380da5
To install your download
For instructions specific to your download, click the Details tab after closing this window.

Flag As Inappropriate

splunk

Google GeoCode

This app has been archived. Learn more about app archiving.
This app is NOT supported by Splunk. Please read about what that means for you here.
Overview
Details
This app helps you translate String address into (latitude, longitude) and also reverse (latitude, longitude) to Address using Google GeoCoding API.

|printgeocode type=geocode address=Address
Returns three new fields: geolocation_status, geolocation_lat and geolocation_lon


|printgeocode type=reverse latfield= lonfield=
Returns two new fields: geolocation_status and geolocation_addr


Requires a API_Key from Google.
API_KEY can be requested from: https://developers.google.com/maps/documentation/javascript/get-api-key

Google allows 2500 requests per day with developer's API Key. One request is mapped against one event.

Google GeoCode App

Overview

Google GeoCode app is a way to translate your address fields into (latitude,longitude) and also reverse i.e. (latitude,longitude) into Address. Just use the command "printgeocode" in pipeline to your Splunk search command and convert your address to geolocation points or vice versa.

Version: 1.7.0

Infrastructure Requiment

Any Operating system (tested on Windows 7/10 and Linux)
Splunk 6.4, 6.5, 6.6

Installation

  • Install the app on your Splunk Search Head(s).
  • Get a google API key from Google API Key
  • Write the API_Key in the setup page.
  • Restart Splunk Search Head.

Usage

  your splunk query|printgeocode type=geocode address=Address_field

Geocoding returns three new fields: geolocation_status, geolocation_lat and geolocation_lon

OR

   your splunk query|printgeocode type=reverse latfield=latfieldname lonfield=lonfieldname

Reverse Geocoding returns two new fields: geolocation_status and geolocation_addr

Where type=geocoding tells the app that it is geocoding and type=reverse indicates that it is Reverse Geocoding
Address_field is the name of the text field in your data which contains a valid address. latfieldname and lonfieldname are fields containing values of latitude and longitudes of an geopoint respectively.

The output fields are prefixed with keyword geolocation.

  • Example-1 Geocoding: Address to latitude,longitude
    index=test sourcetype="users_addresses" 
    | head 2
    | table first_name last_name address city country Address 
    | printgeocode type=geocode address=Address

Geocoding

  • Use map with latitude,longitude from the output of the command
    index=test sourcetype="users_addresses" 
    | head 2
    | table first_name last_name address city country Address
    | printgeocode type=geocode address=Address
    | geostats count latfield=geolocation_lat longfield=geolocation_lon 

Geocoding Map

  • Example-2 Reverse Geocoding: latitude,longitude to Address
    index=test sourcetype="user_latlon" 
    | head 5
    | table policyID line county point_latitude point_longitude 
    | printgeocode type=reverse latfield=point_latitude lonfield=point_longitude 

Reverse Geocoding

As simple as looking for a location on Maps :)

Handling of API key

The Google API Key entered on the setup page is stored as password in encrypted format at Rest Endpoint path:
https://<SPLUNK_SEARCH_HEAD_URL>:8089/servicesNS/nobody/GoogleGeoCode/storage/passwords

Setup

The password is retrieved, decrypted and then the API is invoked. It is stored at $SPLUNK_HOME/etc/apps/GoogleGeoCode/local/passwords.conf

    [credential::Test Server Key:]
    password = $1$DLLZaK+SYHMnEAonrZi7vpuOEpJUXvi3cX3mV1fonSgdiiz3ZR2BHg==

Troubleshooting

  • The field geolocation_status is an indicator of the status from Google's Geolocation API. If everything is okay (input, quota of API key and Internet connection), the status will be "OK". Below are some of the status returned by Google's API-

    • "OK" indicates that no errors occurred; the address was successfully parsed and at least one geocode was returned.
    • "ZERO_RESULTS" indicates that the geocode was successful but returned no results. This may occur if the geocoder was passed a non-existent address.
    • "OVER_QUERY_LIMIT" indicates that you are over your quota.
    • "REQUEST_DENIED" indicates that your request was denied.
    • "INVALID_REQUEST" generally indicates that the query (address, components or latlng) is missing.
    • "UNKNOWN_ERROR" indicates that the request could not be processed due to a server error. The request may succeed if you try again.
  • If you get an error "OVER_QUERY_LIMIT", you can try below options -

  • Option1: Get a new Key and put that value in myconfig.py. Restart Splunk search head, the results should be good.

  • Option 2: Wait for midnight PST timezone for the limit to rest :)

  • When you run the command, the information is logged into $SPLUNK_HOME/var/log/googlegeocode.log

    2018-05-02 14:10:35,167 INFO In Reverse Geocode function
    2018-05-02 14:10:37,578 INFO Status from Google GeoCoding API is OK
    2018-05-02 14:21:28,525 INFO In Reverse Geocode function
    2018-05-02 14:21:30,733 INFO Status from Google GeoCoding API is OK

More information and code is avaialble here:

Gitgub Link

References

The app uses the Google's Geocoding API. Here's the link to their documentation

Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers on a map, or position the map.
Reverse geocoding is the process of converting geographic coordinates into a human-readable address.

The Google Maps Geocoding API provides a direct way to access these services via an HTTP request. The following example uses the Geocoding service through the Google Maps JavaScript API to demonstrate the basic functionality.

Contact Information

For any issues or questions, please reach out to: meenal.luktuke@gmail.com
We provide only Level-1 support for this application.

Release Notes

Version 1.7.1
May 3, 2018
  • Adding encryption of API Key
  • Added logging mechanism
  • Removed geopy dependency
  • Added error handling
Version 1.6.0
March 28, 2018

Changed API from geopy to Google
Added error handling using field - geolocation_status

Version 1.6
March 26, 2018

Added error handling with a new field - geolocation_status

Version 1.5
Oct. 3, 2017

Added conf for syntax highlighting

Version 1.4
Oct. 2, 2017

Added feature for Reverse Geocoding

Version 1.3
Sept. 4, 2017

Changed file permissions

Version 1.2
Aug. 25, 2017

Added code for setup.xml

Version 1.1
June 13, 2017
Version 1.0
May 29, 2017

Subscribe Share

Are you a developer?

As a Splunkbase app developer, you will have access to all Splunk development resources and receive a 10GB license to build an app that will help solve use cases for customers all over the world. Splunkbase has 1000+ apps from Splunk, our partners and our community. Find an app for most any data source and user need, or simply create your own with help from our developer portal.

Follow Us:
Splunk, Splunk>,Turn Data Into Doing, Data-to-Everything, and D2E are trademarks or registered trademarks of Splunk Inc. in the United States and other countries. All other brand names,product names,or trademarks belong to their respective owners.