acquisition

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 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 AcquisReadOneFile

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

A tail-mode file reader (tail)

func AcquisStartReading

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

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

func ReadAtOnce

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

A one shot file reader (cat)

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 InitReader

func InitReader(cfg string) (*FileAcquisCtx, error)

func InitReaderFromFileCtx

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

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

func LoadAcquisitionConfig added in v0.1.4

func LoadAcquisitionConfig(cConfig *csconfig.CrowdSec) (*FileAcquisCtx, error)

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
}

Jump to

Keyboard shortcuts

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