NAME

eris::log::context::GeoIP - Apply MaxMind GeoIPv2 Data to events

VERSION

version 0.004

SYNOPSIS

Use this module to tag geo location data to events with matching field names. You'll probably need to configure the geo_db attribute.

ATTRIBUTES

priority

Defaults to 1000, run last.

field

Defaults to '_exists_'

matcher

A regex matching any string ending in '_ip'.

geo_db

The file location for the GeoIPv2 Databases, defaults to '/usr/share/GeoIP/GeoLite2-City.mmdb'. Set in the config:

---
contexts:
  configs:
    GeoIP:
      geo_db: '/var/lib/geoip/GeoIP2-Full.mmdb'

geo_lookup

This is an instance of a GeoIP2::Database::Reader used to lookup GeoIP data for an IP

warnings

Should warnings about this context failing initialization be displayed.

Defaults to false so you won't get spew when the geo_db is missing.

METHODS

contextualize_message

Inspects the eris::log context for any fields ending in '(.*)_ip'. If found, a new key "${1}_geoip" is created to contain a HashRef with the following data:

city, country, continent, location, traits, postal_code

The only special elements being, location which is "latitude,longitude" and traits, which is an array containing the following possible tags: anonymous, proxy, and/or satellite.

SEE ALSO

eris::log::contextualizer, eris::role::context, GeoIP2::Database::Reader

AUTHOR

Brad Lhotsky <brad@divisionbyzero.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Brad Lhotsky.

This is free software, licensed under:

The (three-clause) BSD License