pkgconfig

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrUnknown = "UNKNOWN"

	ProgQname   = "dns.collector"
	ProgName    = "dnscollector"
	LocalhostIP = "127.0.0.1"
	AnyIP       = "0.0.0.0"
	HTTPOK      = "HTTP/1.1 200 OK\r\n\r\n"

	KeyCollectors = "collectors"
	KeyLoggers    = "loggers"

	ValidDomain    = "dnscollector.dev."
	BadDomainLabel = "ultramegaverytoolonglabel-ultramegaverytoolonglabel-ultramegaverytoolonglabel.dnscollector.dev."

	BadVeryLongDomain = "ultramegaverytoolonglabel.dnscollector" + badLongLabel + badLongLabel +
		badLongLabel + badLongLabel + badLongLabel + ".dev."

	ModeJinja    = "jinja"
	ModeText     = "text"
	ModeJSON     = "json"
	ModeFlatJSON = "flat-json"
	ModePCAP     = "pcap"
	ModeDNSTap   = "dnstap"

	SASLMechanismPlain = "PLAIN"
	SASLMechanismScram = "SCRAM-SHA-512"

	CompressGzip   = "gzip"
	CompressSnappy = "snappy"
	CompressLz4    = "lz4"
	CompressZstd   = "ztd"
	CompressNone   = "none"
)

Variables

View Source
var (
	PrefixLogWorker       = "worker - "
	PrefixLogTransformer  = "transformer - "
	DefaultBufferSize     = 512
	DefaultBufferOne      = 1
	DefaultMonitor        = true
	WorkerMonitorDisabled = false

	ExpectedQname         = "dnscollector.dev"
	ExpectedQname2        = "dns.collector"
	ExpectedBufferMsg511  = ".*buffer is full, 511.*"
	ExpectedBufferMsg1023 = ".*buffer is full, 1023.*"
	ExpectedIdentity      = "powerdnspb"
)

Functions

func CheckConfig added in v0.40.0

func CheckConfig(configFile *os.File) error

func CheckConfigWithTags added in v0.44.0

func CheckConfigWithTags(v reflect.Value, userCfg map[string]interface{}) error

func IsValidMode

func IsValidMode(mode string) bool

func ReloadConfig

func ReloadConfig(configPath string, config *Config) error

Types

type Config

type Config struct {
	Global               ConfigGlobal       `yaml:"global"`
	Collectors           ConfigCollectors   `yaml:"collectors"`
	IngoingTransformers  ConfigTransformers `yaml:"collectors-transformers"`
	Loggers              ConfigLoggers      `yaml:"loggers"`
	OutgoingTransformers ConfigTransformers `yaml:"loggers-transformers"`
	Multiplexer          ConfigMultiplexer  `yaml:"multiplexer"`
	Pipelines            []ConfigPipelines  `yaml:"pipelines"`
}

func GetDefaultConfig added in v0.45.0

func GetDefaultConfig() *Config

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

func (*Config) GetServerIdentity

func (c *Config) GetServerIdentity() string

func (*Config) IsValid added in v0.44.0

func (c *Config) IsValid(userCfg map[string]interface{}) error

func (*Config) SetDefault

func (c *Config) SetDefault()

type ConfigCollectors

type ConfigCollectors struct {
	DNSMessage struct {
		Enable            bool `yaml:"enable" default:"false"`
		ChannelBufferSize int  `yaml:"chan-buffer-size" default:"0"`
		Matching          struct {
			Include map[string]interface{} `yaml:"include"`
			Exclude map[string]interface{} `yaml:"exclude"`
		} `yaml:"matching"`
	} `yaml:"dnsmessage"`
	Tail struct {
		Enable            bool   `yaml:"enable" default:"false"`
		TimeLayout        string `yaml:"time-layout" default:""`
		PatternQuery      string `yaml:"pattern-query" default:""`
		PatternReply      string `yaml:"pattern-reply" default:""`
		FilePath          string `yaml:"file-path" default:""`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"tail"`
	Dnstap struct {
		Enable            bool   `yaml:"enable" default:"false"`
		ListenIP          string `yaml:"listen-ip" default:"0.0.0.0"`
		ListenPort        int    `yaml:"listen-port" default:"6000"`
		SockPath          string `yaml:"sock-path" default:""`
		TLSSupport        bool   `yaml:"tls-support" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		RcvBufSize        int    `yaml:"sock-rcvbuf" default:"0"`
		ResetConn         bool   `yaml:"reset-conn" default:"true"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
		DisableDNSParser  bool   `yaml:"disable-dnsparser" default:"false"`
		ExtendedSupport   bool   `yaml:"extended-support" default:"false"`
		Compression       string `yaml:"compression" default:"none"`
	} `yaml:"dnstap"`
	DnstapProxifier struct {
		Enable            bool   `yaml:"enable" default:"false"`
		ListenIP          string `yaml:"listen-ip" default:"0.0.0.0"`
		ListenPort        int    `yaml:"listen-port" default:"6000"`
		SockPath          string `yaml:"sock-path" default:""`
		TLSSupport        bool   `yaml:"tls-support" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"dnstap-relay"`
	AfpacketLiveCapture struct {
		Enable            bool   `yaml:"enable" default:"false"`
		Port              int    `yaml:"port" default:"53"`
		Device            string `yaml:"device" default:""`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
		FragmentSupport   bool   `yaml:"enable-defrag-ip" default:"true"`
	} `yaml:"afpacket-sniffer"`
	XdpLiveCapture struct {
		Enable            bool   `yaml:"enable" default:"false"`
		Port              int    `yaml:"port" default:"53"`
		Device            string `yaml:"device" default:""`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"xdp-sniffer"`
	PowerDNS struct {
		Enable            bool   `yaml:"enable" default:"false"`
		ListenIP          string `yaml:"listen-ip" default:"0.0.0.0"`
		ListenPort        int    `yaml:"listen-port" default:"6001"`
		TLSSupport        bool   `yaml:"tls-support" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		AddDNSPayload     bool   `yaml:"add-dns-payload" default:"false"`
		RcvBufSize        int    `yaml:"sock-rcvbuf" default:"0"`
		ResetConn         bool   `yaml:"reset-conn" default:"true"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"powerdns"`
	FileIngestor struct {
		Enable            bool   `yaml:"enable" default:"false"`
		WatchDir          string `yaml:"watch-dir" default:""`
		WatchMode         string `yaml:"watch-mode" default:"pcap"`
		PcapDNSPort       int    `yaml:"pcap-dns-port" default:"53"`
		DeleteAfter       bool   `yaml:"delete-after" default:"false"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"file-ingestor"`
	Tzsp struct {
		Enable            bool   `yaml:"enable" default:"false"`
		ListenIP          string `yaml:"listen-ip" default:"0.0.0.0"`
		ListenPort        int    `yaml:"listen-port" default:"10000"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"tzsp"`
}

func (*ConfigCollectors) GetNames added in v0.44.0

func (c *ConfigCollectors) GetNames() (ret []string)

func (*ConfigCollectors) IsExists added in v0.44.0

func (c *ConfigCollectors) IsExists(name string) bool

func (*ConfigCollectors) IsValid added in v0.40.0

func (c *ConfigCollectors) IsValid(userCfg map[string]interface{}) error

func (*ConfigCollectors) SetDefault

func (c *ConfigCollectors) SetDefault()

type ConfigGlobal

type ConfigGlobal struct {
	TextFormat          string `` /* 129-byte string literal not displayed */
	TextFormatDelimiter string `yaml:"text-format-delimiter" default:" "`
	TextFormatBoundary  string `yaml:"text-format-boundary" default:"\""`
	TextJinja           string `yaml:"text-jinja" default:""`
	Trace               struct {
		Verbose      bool   `yaml:"verbose" default:"false"`
		LogMalformed bool   `yaml:"log-malformed" default:"false"`
		Filename     string `yaml:"filename" default:""`
		MaxSize      int    `yaml:"max-size" default:"10"`
		MaxBackups   int    `yaml:"max-backups" default:"10"`
	} `yaml:"trace"`
	ServerIdentity string `yaml:"server-identity" default:""`
	PidFile        string `yaml:"pid-file" default:""`
	Worker         struct {
		InternalMonitor   int `yaml:"interval-monitor" default:"10"`
		ChannelBufferSize int `yaml:"buffer-size" default:"8192"`
	} `yaml:"worker"`
	Telemetry struct {
		Enabled         bool   `yaml:"enabled" default:"false"`
		WebPath         string `yaml:"web-path" default:"/metrics"`
		WebListen       string `yaml:"web-listen" default:":9165"`
		PromPrefix      string `yaml:"prometheus-prefix" default:"dnscollector_exporter"`
		TLSSupport      bool   `yaml:"tls-support" default:"false"`
		TLSCertFile     string `yaml:"tls-cert-file" default:""`
		TLSKeyFile      string `yaml:"tls-key-file" default:""`
		ClientCAFile    string `yaml:"client-ca-file" default:""`
		BasicAuthEnable bool   `yaml:"basic-auth-enable" default:"false"`
		BasicAuthLogin  string `yaml:"basic-auth-login" default:"admin"`
		BasicAuthPwd    string `yaml:"basic-auth-pwd" default:"changeme"`
	} `yaml:"telemetry"`
}

func (*ConfigGlobal) Check added in v0.44.0

func (c *ConfigGlobal) Check(userCfg map[string]interface{}) error

func (*ConfigGlobal) SetDefault

func (c *ConfigGlobal) SetDefault()

type ConfigLoggers

type ConfigLoggers struct {
	DevNull struct {
		Enable            bool `yaml:"enable" default:"false"`
		ChannelBufferSize int  `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"devnull"`
	Stdout struct {
		Enable            bool   `yaml:"enable" default:"false"`
		Mode              string `yaml:"mode" default:"text"`
		TextFormat        string `yaml:"text-format" default:""`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"stdout"`
	Prometheus struct {
		Enable                    bool     `yaml:"enable" default:"false"`
		ListenIP                  string   `yaml:"listen-ip" default:"127.0.0.1"`
		ListenPort                int      `yaml:"listen-port" default:"8081"`
		TLSSupport                bool     `yaml:"tls-support" default:"false"`
		TLSMutual                 bool     `yaml:"tls-mutual" default:"false"`
		TLSMinVersion             string   `yaml:"tls-min-version" default:"1.2"`
		CertFile                  string   `yaml:"cert-file" default:""`
		KeyFile                   string   `yaml:"key-file" default:""`
		PromPrefix                string   `yaml:"prometheus-prefix" default:"dnscollector"`
		LabelsList                []string `yaml:"prometheus-labels" default:"[]"`
		TopN                      int      `yaml:"top-n" default:"10"`
		BasicAuthLogin            string   `yaml:"basic-auth-login" default:"admin"`
		BasicAuthPwd              string   `yaml:"basic-auth-pwd" default:"changeme"`
		BasicAuthEnabled          bool     `yaml:"basic-auth-enable" default:"true"`
		ChannelBufferSize         int      `yaml:"chan-buffer-size" default:"0"`
		RequestersMetricsEnabled  bool     `yaml:"requesters-metrics-enabled" default:"true"`
		DomainsMetricsEnabled     bool     `yaml:"domains-metrics-enabled" default:"true"`
		NoErrorMetricsEnabled     bool     `yaml:"noerror-metrics-enabled" default:"true"`
		ServfailMetricsEnabled    bool     `yaml:"servfail-metrics-enabled" default:"true"`
		NonExistentMetricsEnabled bool     `yaml:"nonexistent-metrics-enabled" default:"true"`
		TimeoutMetricsEnabled     bool     `yaml:"timeout-metrics-enabled" default:"false"`
		HistogramMetricsEnabled   bool     `yaml:"histogram-metrics-enabled" default:"false"`
		RequestersCacheTTL        int      `yaml:"requesters-cache-ttl" default:"250000"`
		RequestersCacheSize       int      `yaml:"requesters-cache-size" default:"3600"`
		DomainsCacheTTL           int      `yaml:"domains-cache-ttl" default:"500000"`
		DomainsCacheSize          int      `yaml:"domains-cache-size" default:"3600"`
		NoErrorDomainsCacheTTL    int      `yaml:"noerror-domains-cache-ttl" default:"100000"`
		NoErrorDomainsCacheSize   int      `yaml:"noerror-domains-cache-size" default:"3600"`
		ServfailDomainsCacheTTL   int      `yaml:"servfail-domains-cache-ttl" default:"10000"`
		ServfailDomainsCacheSize  int      `yaml:"servfail-domains-cache-size" default:"3600"`
		NXDomainsCacheTTL         int      `yaml:"nonexistent-domains-cache-ttl" default:"10000"`
		NXDomainsCacheSize        int      `yaml:"nonexistent-domains-cache-size" default:"3600"`
		DefaultDomainsCacheTTL    int      `yaml:"default-domains-cache-ttl" default:"1000"`
		DefaultDomainsCacheSize   int      `yaml:"default-domains-cache-size" default:"3600"`
	} `yaml:"prometheus"`
	RestAPI struct {
		Enable            bool   `yaml:"enable" default:"false"`
		ListenIP          string `yaml:"listen-ip" default:"127.0.0.1"`
		ListenPort        int    `yaml:"listen-port" default:"8080"`
		BasicAuthLogin    string `yaml:"basic-auth-login" default:"admin"`
		BasicAuthPwd      string `yaml:"basic-auth-pwd" default:"changeme"`
		TLSSupport        bool   `yaml:"tls-support" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		TopN              int    `yaml:"top-n" default:"100"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"restapi"`
	LogFile struct {
		Enable              bool   `yaml:"enable" default:"false"`
		FilePath            string `yaml:"file-path" default:""`
		MaxSize             int    `yaml:"max-size" default:"100"`
		MaxFiles            int    `yaml:"max-files" default:"10"`
		MaxBatchSize        int    `yaml:"max-batch-size" default:"65536"`
		FlushInterval       int    `yaml:"flush-interval" default:"1"`
		Compress            bool   `yaml:"compress" default:"false"`
		CompressInterval    int    `yaml:"compress-interval" default:"60"`
		CompressPostCommand string `yaml:"compress-postcommand" default:""`
		Mode                string `yaml:"mode" default:"text"`
		PostRotateCommand   string `yaml:"postrotate-command" default:""`
		PostRotateDelete    bool   `yaml:"postrotate-delete-success" default:"false"`
		TextFormat          string `yaml:"text-format" default:""`
		ChannelBufferSize   int    `yaml:"chan-buffer-size" default:"0"`
		ExtendedSupport     bool   `yaml:"extended-support" default:"false"`
	} `yaml:"logfile"`
	DNSTap struct {
		Enable            bool   `yaml:"enable" default:"false"`
		RemoteAddress     string `yaml:"remote-address" default:"127.0.0.1"`
		RemotePort        int    `yaml:"remote-port" default:"6000"`
		Transport         string `yaml:"transport" default:"tcp"`
		SockPath          string `yaml:"sock-path" default:""`
		ConnectTimeout    int    `yaml:"connect-timeout" default:"5"`
		RetryInterval     int    `yaml:"retry-interval" default:"10"`
		FlushInterval     int    `yaml:"flush-interval" default:"30"`
		TLSSupport        bool   `yaml:"tls-support" default:"false"`
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		ServerID          string `yaml:"server-id" default:""`
		OverwriteIdentity bool   `yaml:"overwrite-identity" default:"false"`
		BufferSize        int    `yaml:"buffer-size" default:"100"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
		ExtendedSupport   bool   `yaml:"extended-support" default:"false"`
		Compression       string `yaml:"compression" default:"none"`
	} `yaml:"dnstapclient"`
	TCPClient struct {
		Enable            bool   `yaml:"enable" default:"false"`
		RemoteAddress     string `yaml:"remote-address" default:"127.0.0.1"`
		RemotePort        int    `yaml:"remote-port" default:"9999"`
		SockPath          string `yaml:"sock-path" default:""` // deprecated
		RetryInterval     int    `yaml:"retry-interval" default:"10"`
		Transport         string `yaml:"transport" default:"tcp"`
		TLSSupport        bool   `yaml:"tls-support" default:"false"` // deprecated
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		Mode              string `yaml:"mode" default:"flat-json"`
		TextFormat        string `yaml:"text-format" default:""`
		PayloadDelimiter  string `yaml:"delimiter" default:"\n"`
		BufferSize        int    `yaml:"buffer-size" default:"100"`
		FlushInterval     int    `yaml:"flush-interval" default:"30"`
		ConnectTimeout    int    `yaml:"connect-timeout" default:"5"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"tcpclient"`
	Syslog struct {
		Enable            bool   `yaml:"enable" default:"false"`
		Severity          string `yaml:"severity" default:"INFO"`
		Facility          string `yaml:"facility" default:"DAEMON"`
		Transport         string `yaml:"transport" default:"local"`
		RemoteAddress     string `yaml:"remote-address" default:"127.0.0.1:514"`
		RetryInterval     int    `yaml:"retry-interval" default:"10"`
		TextFormat        string `yaml:"text-format" default:""`
		Mode              string `yaml:"mode" default:"text"`
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		Formatter         string `yaml:"formatter" default:"rfc5424"`
		Framer            string `yaml:"framer" default:""`
		Hostname          string `yaml:"hostname" default:""`
		AppName           string `yaml:"app-name" default:"DNScollector"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
		Tag               string `yaml:"tag" default:""`
		ReplaceNullChar   string `yaml:"replace-null-char" default:"�"`
		FlushInterval     int    `yaml:"flush-interval" default:"30"`
		BufferSize        int    `yaml:"buffer-size" default:"100"`
	} `yaml:"syslog"`
	Fluentd struct {
		Enable            bool   `yaml:"enable" default:"false"`
		RemoteAddress     string `yaml:"remote-address" default:"127.0.0.1"`
		RemotePort        int    `yaml:"remote-port" default:"24224"`
		SockPath          string `yaml:"sock-path" default:""` // deprecated
		ConnectTimeout    int    `yaml:"connect-timeout" default:"5"`
		RetryInterval     int    `yaml:"retry-interval" default:"10"`
		FlushInterval     int    `yaml:"flush-interval" default:"30"`
		Transport         string `yaml:"transport" default:"tcp"`
		TLSSupport        bool   `yaml:"tls-support" default:"false"` // deprecated
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		Tag               string `yaml:"tag" default:"dns.collector"`
		BufferSize        int    `yaml:"buffer-size" default:"100"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"4096"`
	} `yaml:"fluentd"`
	InfluxDB struct {
		Enable            bool   `yaml:"enable" default:"false"`
		ServerURL         string `yaml:"server-url" default:"http://localhost:8086"`
		AuthToken         string `yaml:"auth-token" default:""`
		TLSSupport        bool   `yaml:"tls-support" default:"false"`
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		Bucket            string `yaml:"bucket" default:""`
		Organization      string `yaml:"organization" default:""`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"influxdb"`
	LokiClient struct {
		Enable            bool              `yaml:"enable" default:"false"`
		ServerURL         string            `yaml:"server-url" default:"http://localhost:3100/loki/api/v1/push"`
		JobName           string            `yaml:"job-name" default:"dnscollector"`
		Mode              string            `yaml:"mode" default:"text"`
		FlushInterval     int               `yaml:"flush-interval" default:"5"`
		BatchSize         int               `yaml:"batch-size" default:"1048576"`
		RetryInterval     int               `yaml:"retry-interval" default:"10"`
		TextFormat        string            `yaml:"text-format" default:""`
		ProxyURL          string            `yaml:"proxy-url" default:""`
		TLSInsecure       bool              `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string            `yaml:"tls-min-version" default:"1.2"`
		CAFile            string            `yaml:"ca-file" default:""`
		CertFile          string            `yaml:"cert-file" default:""`
		KeyFile           string            `yaml:"key-file" default:""`
		BasicAuthLogin    string            `yaml:"basic-auth-login" default:""`
		BasicAuthPwd      string            `yaml:"basic-auth-pwd" default:""`
		BasicAuthPwdFile  string            `yaml:"basic-auth-pwd-file" default:""`
		TenantID          string            `yaml:"tenant-id" default:""`
		RelabelConfigs    []*relabel.Config `yaml:"relabel-configs" default:"[]"`
		ChannelBufferSize int               `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"lokiclient"`
	Statsd struct {
		Enable            bool   `yaml:"enable" default:"false"`
		Prefix            string `yaml:"prefix" default:"dnscollector"`
		RemoteAddress     string `yaml:"remote-address" default:"127.0.0.1"`
		RemotePort        int    `yaml:"remote-port" default:"8125"`
		ConnectTimeout    int    `yaml:"connect-timeout" default:"5"`
		Transport         string `yaml:"transport" default:"udp"`
		FlushInterval     int    `yaml:"flush-interval" default:"10"`
		CertFile          string `yaml:"cert-file" default:""`
		TLSSupport        bool   `yaml:"tls-support" default:"false"` // deprecated
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"statsd"`
	ElasticSearchClient struct {
		Enable            bool   `yaml:"enable" default:"false"`
		Index             string `yaml:"index" default:"dnscollector"`
		Server            string `yaml:"server" default:"http://127.0.0.1:9200/"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
		BulkSize          int    `yaml:"bulk-size" default:"5242880"`
		BulkChannelSize   int    `yaml:"bulk-channel-size" default:"10"`
		FlushInterval     int    `yaml:"flush-interval" default:"10"`
		Compression       string `yaml:"compression" default:"none"`
	} `yaml:"elasticsearch"`
	ScalyrClient struct {
		Enable            bool                   `yaml:"enable" default:"false"`
		Mode              string                 `yaml:"mode" default:"text"`
		TextFormat        string                 `yaml:"text-format" default:""`
		SessionInfo       map[string]string      `yaml:"sessioninfo" default:"{}"`
		Attrs             map[string]interface{} `yaml:"attrs" default:"{}"`
		ServerURL         string                 `yaml:"server-url" default:"app.scalyr.com"`
		APIKey            string                 `yaml:"apikey" default:""`
		Parser            string                 `yaml:"parser" default:""`
		FlushInterval     int                    `yaml:"flush-interval" default:"10"`
		ProxyURL          string                 `yaml:"proxy-url" default:""`
		TLSInsecure       bool                   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string                 `yaml:"tls-min-version" default:"1.2"`
		CAFile            string                 `yaml:"ca-file" default:""`
		CertFile          string                 `yaml:"cert-file" default:""`
		KeyFile           string                 `yaml:"key-file" default:""`
		ChannelBufferSize int                    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"scalyrclient"`
	RedisPub struct {
		Enable            bool   `yaml:"enable" default:"false"`
		RemoteAddress     string `yaml:"remote-address" default:"127.0.0.1"`
		RemotePort        int    `yaml:"remote-port" default:"6379"`
		SockPath          string `yaml:"sock-path" default:""` // deprecated
		RetryInterval     int    `yaml:"retry-interval" default:"10"`
		Transport         string `yaml:"transport" default:"tcp"`
		TLSSupport        bool   `yaml:"tls-support" default:"false"` // deprecated
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		Mode              string `yaml:"mode" default:"flat-json"`
		TextFormat        string `yaml:"text-format" default:""`
		PayloadDelimiter  string `yaml:"delimiter" default:"\n"`
		BufferSize        int    `yaml:"buffer-size" default:"100"`
		FlushInterval     int    `yaml:"flush-interval" default:"30"`
		ConnectTimeout    int    `yaml:"connect-timeout" default:"5"`
		RedisChannel      string `yaml:"redis-channel" default:"dns_collector"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"redispub"`
	KafkaProducer struct {
		Enable            bool   `yaml:"enable" default:"false"`
		RemoteAddress     string `yaml:"remote-address" default:"127.0.0.1"`
		RemotePort        int    `yaml:"remote-port" default:"9092"`
		RetryInterval     int    `yaml:"retry-interval" default:"10"`
		TLSSupport        bool   `yaml:"tls-support" default:"false"`
		TLSInsecure       bool   `yaml:"tls-insecure" default:"false"`
		TLSMinVersion     string `yaml:"tls-min-version" default:"1.2"`
		CAFile            string `yaml:"ca-file" default:""`
		CertFile          string `yaml:"cert-file" default:""`
		KeyFile           string `yaml:"key-file" default:""`
		SaslSupport       bool   `yaml:"sasl-support" default:"false"`
		SaslUsername      string `yaml:"sasl-username" default:""`
		SaslPassword      string `yaml:"sasl-password" default:""`
		SaslMechanism     string `yaml:"sasl-mechanism" default:"PLAIN"`
		Mode              string `yaml:"mode" default:"flat-json"`
		TextFormat        string `yaml:"text-format" default:""`
		BufferSize        int    `yaml:"buffer-size" default:"100"`
		FlushInterval     int    `yaml:"flush-interval" default:"10"`
		ConnectTimeout    int    `yaml:"connect-timeout" default:"5"`
		Topic             string `yaml:"topic" default:"dnscollector"`
		Partition         *int   `yaml:"partition" default:"nil"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
		Compression       string `yaml:"compression" default:"none"`
	} `yaml:"kafkaproducer"`
	FalcoClient struct {
		Enable            bool   `yaml:"enable" default:"false"`
		URL               string `yaml:"url" default:"http://127.0.0.1:9200"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"falco"`
	ClickhouseClient struct {
		Enable            bool   `yaml:"enable" default:"false"`
		URL               string `yaml:"url" default:"http://localhost:8123"`
		User              string `yaml:"user" default:"default"`
		Password          string `yaml:"password" default:"password"`
		Database          string `yaml:"database" default:"dnscollector"`
		Table             string `yaml:"table" default:"records"`
		ChannelBufferSize int    `yaml:"chan-buffer-size" default:"0"`
	} `yaml:"clickhouse"`
}

func (*ConfigLoggers) GetNames added in v0.44.0

func (c *ConfigLoggers) GetNames() (ret []string)

func (*ConfigLoggers) IsExists added in v0.44.0

func (c *ConfigLoggers) IsExists(name string) bool

func (*ConfigLoggers) IsValid added in v0.40.0

func (c *ConfigLoggers) IsValid(userCfg map[string]interface{}) error

func (*ConfigLoggers) SetDefault

func (c *ConfigLoggers) SetDefault()

type ConfigMultiplexer

type ConfigMultiplexer struct {
	Collectors []MultiplexInOut  `yaml:"collectors"`
	Loggers    []MultiplexInOut  `yaml:"loggers"`
	Routes     []MultiplexRoutes `yaml:"routes"`
}

func (*ConfigMultiplexer) IsValid added in v0.44.0

func (c *ConfigMultiplexer) IsValid(userCfg map[string]interface{}) error

func (*ConfigMultiplexer) SetDefault

func (c *ConfigMultiplexer) SetDefault()

type ConfigPipelines added in v0.40.0

type ConfigPipelines struct {
	Name          string                 `yaml:"name"`
	Transforms    map[string]interface{} `yaml:"transforms"`
	Params        map[string]interface{} `yaml:",inline"`
	RoutingPolicy PipelinesRouting       `yaml:"routing-policy"`
}

func (*ConfigPipelines) IsValid added in v0.44.0

func (c *ConfigPipelines) IsValid(userCfg map[string]interface{}) error

type ConfigTransformers

type ConfigTransformers struct {
	UserPrivacy struct {
		Enable            bool   `yaml:"enable" default:"false"`
		AnonymizeIP       bool   `yaml:"anonymize-ip" default:"false"`
		AnonymizeIPV4Bits string `yaml:"anonymize-v4bits" default:"0.0.0.0/16"`
		AnonymizeIPV6Bits string `yaml:"anonymize-v6bits" default:"::/64"`
		MinimazeQname     bool   `yaml:"minimaze-qname" default:"false"`
		HashQueryIP       bool   `yaml:"hash-query-ip" default:"false"`
		HashReplyIP       bool   `yaml:"hash-reply-ip" default:"false"`
		HashIPAlgo        string `yaml:"hash-ip-algo" default:"sha1"`
	} `yaml:"user-privacy"`
	Normalize struct {
		Enable              bool `yaml:"enable" default:"false"`
		QnameLowerCase      bool `yaml:"qname-lowercase" default:"false"`
		RRLowerCase         bool `yaml:"rr-lowercase" default:"false"`
		QuietText           bool `yaml:"quiet-text" default:"false"`
		AddTld              bool `yaml:"add-tld" default:"false"`
		AddTldPlusOne       bool `yaml:"add-tld-plus-one" default:"false"`
		ReplaceNonPrintable bool `yaml:"qname-replace-nonprintable" default:"false"`
	} `yaml:"normalize"`
	Latency struct {
		Enable            bool `yaml:"enable" default:"false"`
		MeasureLatency    bool `yaml:"measure-latency" default:"false"`
		UnansweredQueries bool `yaml:"unanswered-queries" default:"false"`
		QueriesTimeout    int  `yaml:"queries-timeout" default:"2"`
	} `yaml:"latency"`
	Reducer struct {
		Enable                    bool `yaml:"enable" default:"false"`
		RepetitiveTrafficDetector bool `yaml:"repetitive-traffic-detector" default:"false"`
		QnamePlusOne              bool `yaml:"qname-plus-one" default:"false"`
		WatchInterval             int  `yaml:"watch-interval" default:"5"`
	} `yaml:"reducer"`
	Filtering struct {
		Enable          bool     `yaml:"enable" default:"false"`
		DropFqdnFile    string   `yaml:"drop-fqdn-file" default:""`
		DropDomainFile  string   `yaml:"drop-domain-file" default:""`
		KeepFqdnFile    string   `yaml:"keep-fqdn-file" default:""`
		KeepDomainFile  string   `yaml:"keep-domain-file" default:""`
		DropQueryIPFile string   `yaml:"drop-queryip-file" default:""`
		KeepQueryIPFile string   `yaml:"keep-queryip-file" default:""`
		KeepRdataFile   string   `yaml:"keep-rdata-file" default:""`
		DropRcodes      []string `yaml:"drop-rcodes,flow" default:"[]"`
		LogQueries      bool     `yaml:"log-queries" default:"true"`
		LogReplies      bool     `yaml:"log-replies" default:"true"`
		Downsample      int      `yaml:"downsample" default:"0"`
	} `yaml:"filtering"`
	GeoIP struct {
		Enable        bool   `yaml:"enable" default:"false"`
		LookupECS     bool   `yaml:"lookup-ecs" default:"false"`
		DBCountryFile string `yaml:"mmdb-country-file" default:""`
		DBCityFile    string `yaml:"mmdb-city-file" default:""`
		DBASNFile     string `yaml:"mmdb-asn-file" default:""`
	} `yaml:"geoip"`
	Suspicious struct {
		Enable             bool     `yaml:"enable" default:"false"`
		ThresholdQnameLen  int      `yaml:"threshold-qname-len" default:"100"`
		ThresholdPacketLen int      `yaml:"threshold-packet-len" default:"1000"`
		ThresholdSlow      float64  `yaml:"threshold-slow" default:"1.0"`
		CommonQtypes       []string `` /* 158-byte string literal not displayed */
		UnallowedChars     []string `yaml:"unallowed-chars,flow" default:"[\"\\\"\", \"==\", \"/\", \":\"]"`
		ThresholdMaxLabels int      `yaml:"threshold-max-labels" default:"10"`
		WhitelistDomains   []string `yaml:"whitelist-domains,flow" default:"[\"\\\\.ip6\\\\.arpa\"]"`
	} `yaml:"suspicious"`
	Extract struct {
		Enable     bool `yaml:"enable" default:"false"`
		AddPayload bool `yaml:"add-payload" default:"false"`
	} `yaml:"extract"`
	MachineLearning struct {
		Enable      bool `yaml:"enable" default:"false"`
		AddFeatures bool `yaml:"add-features" default:"false"`
	} `yaml:"machine-learning"`
	ATags struct {
		Enable  bool     `yaml:"enable" default:"false"`
		AddTags []string `yaml:"add-tags,flow" default:"[]"`
	} `yaml:"atags"`
	Relabeling struct {
		Enable bool               `yaml:"enable" default:"false"`
		Rename []RelabelingConfig `yaml:"rename,flow"`
		Remove []RelabelingConfig `yaml:"remove,flow"`
	} `yaml:"relabeling"`
	Rewrite struct {
		Enable      bool                   `yaml:"enable" default:"false"`
		Identifiers map[string]interface{} `yaml:"identifiers,flow"`
	} `yaml:"rewrite"`
}

func GetFakeConfigTransformers

func GetFakeConfigTransformers() *ConfigTransformers

func (*ConfigTransformers) IsValid added in v0.44.0

func (c *ConfigTransformers) IsValid(userCfg map[string]interface{}) error

func (*ConfigTransformers) SetDefault

func (c *ConfigTransformers) SetDefault()

type MultiplexInOut

type MultiplexInOut struct {
	Name        string                 `yaml:"name"`
	Transforms  map[string]interface{} `yaml:"transforms"`
	Params      map[string]interface{} `yaml:",inline"`
	IsCollector bool
}

func (*MultiplexInOut) IsValid added in v0.44.0

func (c *MultiplexInOut) IsValid(userCfg map[string]interface{}) error

type MultiplexRoutes

type MultiplexRoutes struct {
	Src []string `yaml:"from,flow"`
	Dst []string `yaml:"to,flow"`
}

func (*MultiplexRoutes) IsValid added in v0.44.0

func (c *MultiplexRoutes) IsValid(userCfg map[string]interface{}) error

type PipelinesRouting added in v0.40.0

type PipelinesRouting struct {
	Forward []string `yaml:"forward,flow"`
	Dropped []string `yaml:"dropped,flow"`
}

func (*PipelinesRouting) IsValid added in v0.44.0

func (c *PipelinesRouting) IsValid(userCfg map[string]interface{}) error

type RelabelingConfig added in v0.43.0

type RelabelingConfig struct {
	Regex       string `yaml:"regex"`
	Replacement string `yaml:"replacement"`
}

Jump to

Keyboard shortcuts

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