acquisition

package
v1.7.5-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyYAMLDocument = errors.New("empty yaml document")

Functions

func DataSourceConfigure added in v1.0.0

func DataSourceConfigure(
	ctx context.Context,
	commonConfig configuration.DataSourceCommonCfg,
	yamlConfig []byte,
	metricsLevel metrics.AcquisitionMetricsLevel,
	hub *cwhub.Hub,
) (types.DataSource, error)

DataSourceConfigure creates and returns a DataSource object from a configuration, if the configuration is not valid it returns an error. If the datasource can't be run (eg. journalctl not available), it still returns an error which can be checked for the appropriate action.

func GetMetrics added in v1.1.0

func GetMetrics(sources []types.DataSource, aggregated bool) error

func GetMetricsLevelFromPromCfg added in v1.6.1

func GetMetricsLevelFromPromCfg(prom *csconfig.PrometheusCfg) metrics.AcquisitionMetricsLevel

func LoadAcquisitionFromDSN added in v1.1.0

func LoadAcquisitionFromDSN(
	ctx context.Context,
	dsn string,
	labels map[string]string,
	transformExpr string,
	hub *cwhub.Hub,
) (types.DataSource, error)

func LoadAcquisitionFromFiles added in v1.6.10

func LoadAcquisitionFromFiles(
	ctx context.Context,
	config *csconfig.CrowdsecServiceCfg,
	prom *csconfig.PrometheusCfg,
	hub *cwhub.Hub,
) ([]types.DataSource, error)

LoadAcquisitionFromFiles unmarshals the configuration item and checks its availability

func StartAcquisition added in v1.0.0

func StartAcquisition(
	ctx context.Context,
	sources []types.DataSource,
	output chan pipeline.Event,
	acquisTomb *tomb.Tomb,
) error

Types

type DataSourceUnavailableError added in v1.5.3

type DataSourceUnavailableError struct {
	Name string
	Err  error
}

func (*DataSourceUnavailableError) Error added in v1.5.3

func (*DataSourceUnavailableError) Unwrap added in v1.5.3

func (e *DataSourceUnavailableError) Unwrap() error

type ParsedSourceConfig

type ParsedSourceConfig struct {
	Common           configuration.DataSourceCommonCfg
	Source           types.DataSource
	Transform        *vm.Program
	SourceMissing    bool   // the "source" field was missing, and detected
	SourceOverridden string // the "source" field was not missing, but didn't match the detected one
}

func ParseSourceConfig

func ParseSourceConfig(ctx context.Context, yamlDoc []byte, metricsLevel metrics.AcquisitionMetricsLevel, hub *cwhub.Hub) (*ParsedSourceConfig, error)

ParseSourceConfig validates and configures one YAML document.

It does not expand env variables, they must already be expanded.

- return sentinel error for empty/comment-only documents - backward-compat source auto-detection (filename/filenames/journalctl_filter) - validate common fields - delegate per-source config validation to the appropriate module - compile transform expression

Jump to

Keyboard shortcuts

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