lookuptable

package
v0.0.0-...-c13075e Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 11 Imported by: 0

README

Lookuptable

Translate key to value from file.

Configuration


filter:
  - type: lookuptable
    # Source field to match in lookup table, default: empty
    source: hostname
    # Target field where lookup value is set, default: empty
    target: service
    # File containing lookups, default: empty
    lookup_file: "hosts-lookuptable.txt"
    # (optional) Cache size, default: 1000
    cache_size: 1000

Lookup file contains one key-value pair per line. Mapping must be in format :. All additional colons in key or value must be escaped with ''. If source-field matches lookup key, a target field is set to lookup value.

Example lookup file

Map source hostname to service as per hosts-lookuptable.txt. Use example yaml config block.

hosts-lookuptable.txt:

192.168.100.10:webserver
192.168.100.20:db-server
192.168.100.20\:22:ssh-server

Documentation

Index

Constants

View Source
const ModuleName = "lookuptable"

ModuleName is the name used in config file

Variables

This section is empty.

Functions

func InitHandler

func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeFilterConfig, error)

InitHandler initialize the filter plugin

Types

type FilterConfig

type FilterConfig struct {
	config.FilterConfig

	// The field containing the user agent string.
	Source string `json:"source"`

	// The name of the field to assign user agent data into.
	// If not specified user agent data will be stored in the root of the event.
	Target string `json:"target"`

	// LookupFile contains one key-value mapping per line
	LookupFile string `json:"lookup_file"`

	// UA parsing is surprisingly expensive.
	// We can optimize it by adding a cache
	CacheSize int `json:"cache_size"`
	// contains filtered or unexported fields
}

FilterConfig holds the configuration json fields and internal objects

func DefaultFilterConfig

func DefaultFilterConfig() FilterConfig

DefaultFilterConfig returns an FilterConfig struct with default values

func (*FilterConfig) Event

Event the main filter event

Jump to

Keyboard shortcuts

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