# geoipsed *Fast, inline geolocation decoration of IPv4 and IPv6 addresses written in Rust* ## Concept IP address metadata is essential to network defense and incident response. City and country-level geolocation can be clues to rule in or rule out IPs of interest. ASN metadata provides insights of network ownership as well as simply identifying which IPs are internet-routable vs which are internal, private, or bogons. In command line log analysis, IP geolocation metadata is most useful in *addition* to the already available log metadata on each line. `geoipsed` enriches IP addresses *in place* leaving the existing context intact. ## Features * IPv4 and IPv6 address support * City, Country, ASN, time zone fields among the available metadata * Flexible templating to customize how `geoipsed` decorates matching IPs * Coloring to more readily spot the IPs in the logs * Optional mode to just emit the matching IPs just like grep/ripgrep `-o` parameter * Spaces are removed from decoration labels so as not to mess up column numbering in your logs ## Install `geoipsed` uses Maxmind's GeoLite2-ASN.mmdb and GeoLite2-City.mmdb files. Follow the instructions to obtain these files here: https://dev.maxmind.com/geoip/updating-databases Currently, `geoipsed` looks exclusively to `/usr/share/GeoIP` for the mmdb files, however you can override this with the `-I` command line option or the environment variable `MAXMIND_MMDB_DIR`. Build and install with cargo: ``` cargo install --git https://github.com/erichutchins/geoipsed ``` ## Usage ``` geoipsed 0.1.3 Inline decoration of IPv4 and IPv6 address geolocations USAGE: geoipsed [OPTIONS] [FILE]... ARGS: ... Input file(s) to process. Leave empty or use "-" to read from stdin OPTIONS: -C, --color Use markers to highlight the matching strings [default: auto] [possible values: always, never, auto] -h, --help Print help information -I Specify directory containing GeoLite2-ASN.mmdb and GeoLite2-City.mmdb [env: MAXMIND_MMDB_DIR=] -L, --list-templates Display a list of available template substitution parameters to use in --template format string -o, --only-matching Show only nonempty parts of lines that match -t, --template