config

package
v0.0.0-...-8a44fb0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTasks

func GetTasks(config Config) map[string]*TaskConfig

GetTasks根据主配置定义的从配置目录,获取采集器定义的任务列表

func Register

func Register(name string, factory Factory) error

Register 用于处理采集任务配置兼容

Types

type ConditionConfig

type ConditionConfig struct {
	Index int    `config:"index"`
	Key   string `config:"key"`
	Op    string `config:"op"`
}

ConditionConfig: 用于条件表达式,目前支持=、!=

type ConditionSortByIndex

type ConditionSortByIndex []ConditionConfig

condition配置

func (ConditionSortByIndex) Len

func (a ConditionSortByIndex) Len() int

Len is the number of elements in the collection.

func (ConditionSortByIndex) Less

func (a ConditionSortByIndex) Less(i, j int) bool

Len is the number of elements in the collection.

func (ConditionSortByIndex) Swap

func (a ConditionSortByIndex) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type Config

type Config struct {
	// Max bytes for  buffer
	MaxBytes int `config:"maxbytes"`
	// max line for buffer
	Maxline int `config:"maxline"`
	// timeout for buffer
	BufferTimeout time.Duration `config:"buffertimeout"`
	// max cpu limit percent
	MaxCpuLimit int `config:"max_cpu_limit"` // 最大CPU限制,仅在某些极端情况下开启
	// CpuCheckTimes
	CpuCheckTimes int `config:"cpu_check_times"` // 1秒内检测多少次CPU, 可选值,[1-10]

	// SecConfigs sec config path and pattern
	SecConfigs []SecConfigItem `config:"multi_config"`

	Registry Registry `config:"registry"`
}

主配置

func Parse

func Parse(cfg *beat.Config) (Config, error)

Parse用于主配置解析

type Factory

type Factory = func(rawConfig *beat.Config) (*beat.Config, error)

默认配置

type FilterConfig

type FilterConfig struct {
	Conditions []ConditionConfig `config:"conditions"`
}

FilterConfig line filter config

type Registry

type Registry struct {
	FlushTimeout time.Duration `config:"flush"`
	GcFrequency  time.Duration `config:"gc_frequency"`
}

采集状态

type SecConfigItem

type SecConfigItem struct {
	Path    string `config:"path"`
	Pattern string `config:"file_pattern"`
}

从配置目录

type TaskConfig

type TaskConfig struct {
	ID     string
	Type   string `config:"type"`
	DataID int    `config:"dataid"`
	// Processor
	Processors processors.PluginConfig `config:"processors"`
	Delimiter  string                  `config:"delimiter"`
	Filters    []FilterConfig          `config:"filters"`
	HasFilter  bool
	// Sender
	CanPackage   bool        `config:"package"`
	PackageCount int         `config:"package_count"`
	ExtMeta      interface{} `config:"ext_meta"`

	// Output
	RemovePathPrefix string `config:"remove_path_prefix"` // 去除路径前缀
	IsContainerStd   bool   `config:"is_container_std"`   // 是否为容器标准输出日志
	OutputFormat     string `config:"output_format"`      // 输出格式,为了兼容老版采集器的输出格式

	RawConfig *beat.Config
}

采集任务配置

func CreateTaskConfig

func CreateTaskConfig(vars map[string]interface{}) (*TaskConfig, error)

CreateTaskConfig: 根据字典生成任务配置

func NewTaskConfig

func NewTaskConfig(rawConfig *beat.Config) (*TaskConfig, error)

创建采集任务配置

func (*TaskConfig) Same

func (sourceConfig *TaskConfig) Same(targetConfig *TaskConfig) bool

Same用于采集器reload时,比较同一dataid的任务是否有做调整

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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