Documentation
¶
Index ¶
- Variables
- func GetMetrics(sources []DataSource, aggregated bool) error
- func GetMetricsLevelFromPromCfg(prom *csconfig.PrometheusCfg) metrics.AcquisitionMetricsLevel
- func StartAcquisition(ctx context.Context, sources []DataSource, output chan pipeline.Event, ...) error
- type DSNConfigurer
- type DataSource
- func DataSourceConfigure(ctx context.Context, commonConfig configuration.DataSourceCommonCfg, ...) (DataSource, error)
- func GetDataSourceIface(dataSourceType string) (DataSource, error)
- func LoadAcquisitionFromDSN(ctx context.Context, dsn string, labels map[string]string, ...) (DataSource, error)
- func LoadAcquisitionFromFiles(ctx context.Context, config *csconfig.CrowdsecServiceCfg, ...) ([]DataSource, error)
- type DataSourceUnavailableError
- type Fetcher
- type MetricsProvider
- type RestartableStreamer
- type Tailer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // We register the datasources at init time so we can tell if they are unsupported, or excluded from the build AcquisitionSources = map[string]func() DataSource{} )
Functions ¶
func GetMetrics ¶ added in v1.1.0
func GetMetrics(sources []DataSource, aggregated bool) error
func GetMetricsLevelFromPromCfg ¶ added in v1.6.1
func GetMetricsLevelFromPromCfg(prom *csconfig.PrometheusCfg) metrics.AcquisitionMetricsLevel
func StartAcquisition ¶ added in v1.0.0
Types ¶
type DSNConfigurer ¶ added in v1.7.1
type DataSource ¶ added in v1.0.0
type DataSource interface {
// identity, lifecycle
GetMode() string // Get the mode (TAIL, CAT or SERVER)
GetName() string // Get the name of the module
GetUuid() string // Get the unique identifier of the datasource
Dump() any
CanRun() error // Whether the datasource can run or not (eg, journalctl on BSD is a non-sense)
// configuration
UnmarshalConfig(yamlConfig []byte) error // Decode and pre-validate the YAML datasource - anything that can be checked before runtime
Configure(ctx context.Context, yamlConfig []byte, logger *log.Entry, metricsLevel metrics.AcquisitionMetricsLevel) error // Complete the YAML datasource configuration and perform runtime checks.
}
The interface each datasource must implement
func DataSourceConfigure ¶ added in v1.0.0
func DataSourceConfigure(ctx context.Context, commonConfig configuration.DataSourceCommonCfg, yamlConfig []byte, metricsLevel metrics.AcquisitionMetricsLevel) (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 GetDataSourceIface ¶ added in v1.1.0
func GetDataSourceIface(dataSourceType string) (DataSource, error)
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) ([]DataSource, error)
LoadAcquisitionFromFiles unmarshals the configuration item and checks its availability
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 MetricsProvider ¶ added in v1.7.1
type MetricsProvider interface {
// Returns pointers to metrics that are managed by the module
GetMetrics() []prometheus.Collector
// Returns pointers to metrics that are managed by the module (aggregated mode, limits cardinality)
GetAggregMetrics() []prometheus.Collector
}
type RestartableStreamer ¶ added in v1.7.4
RestartableStreamer works Like Tailer but should return any error and leave the retry logic to the caller
Source Files
¶
Click to show internal directories.
Click to hide internal directories.