geoipprocessor

package module
v0.0.0-...-719ad8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

GeoIP Processor

Supported pipeline types: metrics, traces, logs

The resource processor can be used to apply changes on resource attributes. Please refer to config.go for the config spec.

Examples:

processors:
  geoip:
    # The field to get the ip address from for the geographical lookup.
    field:
      - ip
    # The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory.
    database_file: GeoLite2-City.mmdb
    # The field that will hold the geographical information looked up from the MaxMind database.
    target_field: geoip
    # If true and field does not exist, the processor quietly exits without modifying the document
    ignore_missing: false
    # If true only first found geoip data will be returned, even if field contains array
    first_only: true
    # Controls what properties are added to the target_field based on the geoip lookup.
    properties:
      - continent_name
      - country_iso_code
      - country_name
      - region_iso_code
      - region_name
      - city_name
      - location

Refer to config.yaml for detailed examples on using the processor.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() component.ProcessorFactory

NewFactory returns a new factory for the Resource processor.

Types

type Config

type Config struct {
	config.ProcessorSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct

	// The field to get the ip address from for the geographical lookup.
	Field []string `mapstructure:"field"`
	// The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the ingest-geoip config directory.
	DatabaseFile string `mapstructure:"database_file"`
	// The field that will hold the geographical information looked up from the MaxMind database.
	TargetField string `mapstructure:"target_field"`
	// If true and field does not exist, the processor quietly exits without modifying the document
	// IgnoreMissing bool `mapstructure:"ignore_missing"`
	// If true only first found geoip data will be returned, even if field contains array
	// FirstOnly bool `mapstructure:"first_only"`
	// Controls what properties are added to the target_field based on the geoip lookup.
	// "continent_name", "country_iso_code", "country_name", "city_name", "location", "geohash"
	Properties []string `mapstructure:"properties"`

	HashPrecision uint `mapstructure:"hash_precision"`
	// contains filtered or unexported fields
}

Config defines configuration for Resource processor.

func (*Config) Validate

func (cfg *Config) Validate() (err error)

Validate checks if the processor configuration is valid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL