acquisition

package
v1.0.0-rc Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TAILMODE = "tail"
	CATMODE  = "cat"
)
View Source
const (
	FILETYPE = "file"
	BINTYPE  = "bin"
)

Variables

View Source
var ReaderHits = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: "cs_reader_hits_total",
		Help: "Total lines where read.",
	},
	[]string{"source"},
)

Functions

func AcquisStartReading

func AcquisStartReading(ctx *FileAcquisCtx, output chan types.Event, AcquisTomb *tomb.Tomb) error

let's return an array of chans for signaling for now

func CatFile

func CatFile(ctx FileCtx, output chan types.Event, AcquisTomb *tomb.Tomb) error

A one shot file reader (cat)

func TailFile

func TailFile(ctx FileCtx, output chan types.Event, AcquisTomb *tomb.Tomb) error

A tail-mode file reader (tail)

Types

type Acquisition

type Acquisition interface {
	Init(map[string]interface{}) (interface{}, error)
	ReadOne(interface{}) (string, error)
}

type FileAcquisCtx

type FileAcquisCtx struct {
	Files     []FileCtx
	Profiling bool
}

func InitReaderFromFileCtx

func InitReaderFromFileCtx(files []FileCtx) (*FileAcquisCtx, error)

InitReader iterates over the FileCtx objects of cfg and resolves globbing to open files

type FileCtx

type FileCtx struct {
	Type      string   `yaml:"type,omitempty"` //file|bin|...
	Mode      string   `yaml:"mode,omitempty"` //tail|cat|...
	Filename  string   `yaml:"filename,omitempty"`
	Filenames []string `yaml:"filenames,omitempty"`

	Labels    map[string]string `yaml:"labels,omitempty"`
	Profiling bool              `yaml:"profiling,omitempty"`
	// contains filtered or unexported fields
}

func LoadAcquisCtxConfigFile

func LoadAcquisCtxConfigFile(config *csconfig.CrowdsecServiceCfg) ([]FileCtx, error)

LoadAcquisCtxConfigFile Loading a acquis.yaml file for acquisition

func LoadAcquisCtxSingleFile

func LoadAcquisCtxSingleFile(path string, filetype string) ([]FileCtx, error)

LoadAcquisCtxSingleFile Loading a single file path/type for acquisition

Jump to

Keyboard shortcuts

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