Documentation
¶
Index ¶
- Variables
- func DataSourceConfigure(ctx context.Context, commonConfig configuration.DataSourceCommonCfg, ...) (types.DataSource, error)
- func GetMetrics(sources []types.DataSource, aggregated bool) error
- func GetMetricsLevelFromPromCfg(prom *csconfig.PrometheusCfg) metrics.AcquisitionMetricsLevel
- func LoadAcquisitionFromDSN(ctx context.Context, dsn string, labels map[string]string, ...) (types.DataSource, error)
- func LoadAcquisitionFromFiles(ctx context.Context, config *csconfig.CrowdsecServiceCfg, ...) ([]types.DataSource, error)
- func StartAcquisition(ctx context.Context, sources []types.DataSource, output chan pipeline.Event, ...) error
- type DataSourceUnavailableError
- type ParsedSourceConfig
Constants ¶
This section is empty.
Variables ¶
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 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
Types ¶
type DataSourceUnavailableError ¶ added in v1.5.3
type DataSourceUnavailableError struct {
}
func (*DataSourceUnavailableError) Error ¶ added in v1.5.3
func (e *DataSourceUnavailableError) Error() string
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