Documentation ¶
Index ¶
- Variables
- func StartAcquisition(sources []DataSource, output chan types.Event, AcquisTomb *tomb.Tomb) error
- type DataSource
- type DataSourceCfg
- type FileSource
- func (f *FileSource) CatOneFile(output chan types.Event, AcquisTomb *tomb.Tomb, idx int) error
- func (f *FileSource) Configure(Config DataSourceCfg) error
- func (f *FileSource) Mode() string
- func (f *FileSource) StartCat(output chan types.Event, AcquisTomb *tomb.Tomb) error
- func (f *FileSource) StartReading(out chan types.Event, t *tomb.Tomb) error
- func (f *FileSource) StartTail(output chan types.Event, AcquisTomb *tomb.Tomb) error
- func (f *FileSource) TailOneFile(output chan types.Event, AcquisTomb *tomb.Tomb, idx int) error
- type JournaldSource
- func (j *JournaldSource) Configure(config DataSourceCfg) error
- func (j *JournaldSource) Mode() string
- func (j *JournaldSource) StartCat(out chan types.Event, t *tomb.Tomb) error
- func (j *JournaldSource) StartReading(out chan types.Event, t *tomb.Tomb) error
- func (j *JournaldSource) StartTail(out chan types.Event, t *tomb.Tomb) error
Constants ¶
This section is empty.
Variables ¶
View Source
var CAT_MODE = "cat"
View Source
var JOURNALD_CMD = "journalctl"
View Source
var JOURNALD_DEFAULT_CAT_ARGS = []string{}
View Source
var JOURNALD_DEFAULT_TAIL_ARGS = []string{"--follow"}
View Source
var ReaderHits = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_reader_hits_total", Help: "Total lines where read.", }, []string{"source"}, )
View Source
var TAIL_MODE = "tail"
Functions ¶
func StartAcquisition ¶ added in v1.0.0
Types ¶
type DataSource ¶ added in v1.0.0
type DataSource interface { Configure(DataSourceCfg) error /*the readers must watch the tomb (especially in tail mode) to know when to shutdown. tomb is as well used to trigger general shutdown when a datasource errors */ StartReading(chan types.Event, *tomb.Tomb) error Mode() string //return CAT_MODE or TAIL_MODE }
func DataSourceConfigure ¶ added in v1.0.0
func DataSourceConfigure(config DataSourceCfg) (DataSource, error)
func LoadAcquisitionFromFile ¶ added in v1.0.0
func LoadAcquisitionFromFile(config *csconfig.CrowdsecServiceCfg) ([]DataSource, error)
type DataSourceCfg ¶ added in v1.0.0
type DataSourceCfg struct { Mode string `yaml:"mode,omitempty"` //tail|cat|... Filename string `yaml:"filename,omitempty"` Filenames []string `yaml:"filenames,omitempty"` JournalctlFilters []string `yaml:"journalctl_filter,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` Profiling bool `yaml:"profiling,omitempty"` }
type FileSource ¶ added in v1.0.0
type FileSource struct { Config DataSourceCfg Files []string // contains filtered or unexported fields }
func (*FileSource) CatOneFile ¶ added in v1.0.0
A one shot file reader (cat)
func (*FileSource) Configure ¶ added in v1.0.0
func (f *FileSource) Configure(Config DataSourceCfg) error
func (*FileSource) Mode ¶ added in v1.0.0
func (f *FileSource) Mode() string
func (*FileSource) StartReading ¶ added in v1.0.0
func (*FileSource) TailOneFile ¶ added in v1.0.0
A tail-mode file reader (tail)
type JournaldSource ¶ added in v1.0.0
type JournaldSource struct { Config DataSourceCfg Cmd *exec.Cmd Stdout io.ReadCloser Stderr io.ReadCloser Decoder *json.Decoder SrcName string }
func (*JournaldSource) Configure ¶ added in v1.0.0
func (j *JournaldSource) Configure(config DataSourceCfg) error
func (*JournaldSource) Mode ¶ added in v1.0.0
func (j *JournaldSource) Mode() string
func (*JournaldSource) StartReading ¶ added in v1.0.0
Click to show internal directories.
Click to hide internal directories.