config

package
v0.0.0-...-a257059 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT, MIT Imports: 14 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 用于处理采集任务配置兼容

func RemoveFields

func RemoveFields(config *common.Config, from interface{})

Types

type ConditionConfig

type ConditionConfig struct {
	Index int    `config:"index"`
	Key   string `config:"key"`
	Op    string `config:"op"`
	// contains filtered or unexported fields
}

ConditionConfig : 用于条件表达式,目前支持=、!=、eq、neq、include、exclude、regex、nregex

func (*ConditionConfig) GetMatcher

func (c *ConditionConfig) GetMatcher() MatchFunc

type ConditionSortByIndex

type ConditionSortByIndex []ConditionConfig

ConditionSortByIndex 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

Less compare

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"`

	// Tasks 允许加载子配置采集项
	Tasks []interface{} `config:"tasks"`

	Registry Registry `config:"registry"`

	HostIDPath         string `config:"host_id_path"`
	CmdbLevelMaxLength int    `config:"cmdb_level_max_length"`
	IgnoreCmdbLevel    bool   `config:"ignore_cmdb_level"`
	MustHostIDExist    bool   `config:"must_host_id_exist"`
	CheckDiff          bool   `config:"check_diff"`
}

主配置

func Parse

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

Parse用于主配置解析

type Factory

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

Factory 默认配置

type FilterConfig

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

FilterConfig line filter config

type FiltersConfig

type FiltersConfig struct {
	Delimiter string         `config:"delimiter"`
	Filters   []FilterConfig `config:"filters"`
	HasFilter bool
}

type MatchFunc

type MatchFunc func(text string) bool

type ProcessorConfig

type ProcessorConfig struct {
	Processors processors.PluginConfig `config:"processors"`
}

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 SenderConfig

type SenderConfig struct {
	CanPackage   bool `config:"package"`
	PackageCount int  `config:"package_count"`

	// meta
	ExtMeta      map[string]interface{} `config:"ext_meta"`
	ExtMetaFiles []string               `config:"ext_meta_files"`
	ExtMetaEnv   map[string]string      `config:"ext_meta_env"`

	// Output
	RemovePathPrefix string `config:"remove_path_prefix"` // 去除路径前缀
	OutputFormat     string `config:"output_format"`      // 输出格式,为了兼容老版采集器的输出格式
}

func (SenderConfig) GetExtMeta

func (c SenderConfig) GetExtMeta() map[string]interface{}

type TaskConfig

type TaskConfig struct {
	ID     string
	Type   string `config:"type"`
	DataID int    `config:"dataid"`

	ProcessorConfig `config:",inline"`
	FiltersConfig   `config:",inline"`
	SenderConfig    `config:",inline"`

	// 用来标识配置的唯一性
	InputID     string
	FilterID    string
	ProcessorID string
	SenderID    string

	IsContainerStd    bool `config:"is_container_std"`     // 是否为容器标准输出日志(docker)
	IsCRIContainerStd bool `config:"is_cri_container_std"` // 是否为容器标准输出日志(CRI)

	Output common.ConfigNamespace `config:"output"`

	RawConfig *beat.Config
	// contains filtered or unexported fields
}

TaskConfig 采集任务配置

func CreateTaskConfig

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

CreateTaskConfig 根据字典生成任务配置

func NewTaskConfig

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

NewTaskConfig 创建采集任务配置

func (*TaskConfig) GetExtMeta

func (c *TaskConfig) GetExtMeta() map[string]interface{}

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