logs

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileTypeJSON      = "json"
	FileTypeText      = "text"
	FileTypeMultiline = "multiline"
)
View Source
const (
	KVLogfileStateBucket = "log_state_bucket"
)

Variables

This section is empty.

Functions

func LoadFileID

func LoadFileID(fi os.FileInfo, path string) (map[string]interface{}, error)

func New

func NewFromConfig

func NewFromConfig(cfg Config) (pipeline.Processor, error)

func SaveFileState

func SaveFileState(path string, source FileState)

Types

type Cluster

type Cluster struct {
	Name string `json:"name"`
	ID   string `json:"id"`
	UUID string `json:"uuid"`
}

type Config

type Config struct {
	QueueName string      `config:"queue_name"`
	LogsPath  string      `config:"logs_path"`
	Metadata  util.MapStr `config:"metadata"`
	Patterns  []*Pattern  `config:"patterns"`
}

type FSEvent

type FSEvent struct {
	Pattern *Pattern // matched pattern
	Path    string
	Offset  int64
	Op      Operation
	Info    os.FileInfo
	State   FileState
}

type File

type File struct {
	Path   string `json:"path"`
	Offset int64  `json:"offset"`
}

type FileDetector

type FileDetector struct {
	// contains filtered or unexported fields
}

func NewFileDetector

func NewFileDetector(rootPath string, patterns []*Pattern) *FileDetector

func (*FileDetector) Detect

func (w *FileDetector) Detect(ctx context.Context)

func (*FileDetector) Event

func (w *FileDetector) Event() FSEvent

func (*FileDetector) IsSameFile

func (w *FileDetector) IsSameFile(preState FileState, currentInfo os.FileInfo, path string) bool

IsSameFile whether preState's file info and current file info describe the same file

type FileState

type FileState struct {
	Name    string    `json:"name"`
	Size    int64     `json:"size"`
	ModTime time.Time `json:"mod_time"`
	Path    string    `json:"path"`
	Offset  int64     `json:"offset"`
	Sys     any       `json:"sys"`
}

func GetFileState

func GetFileState(path string) (FileState, error)

type LogEvent

type LogEvent struct {
	AgentMeta *event.AgentMeta `json:"agent" elastic_mapping:"agent: { type: object }"`
	Meta      util.MapStr      `json:"metadata" elastic_mapping:"metadata: { type: object }"`
	Fields    util.MapStr      `json:"payload" elastic_mapping:"payload: { type: object }"`
	Timestamp string           `json:"timestamp,omitempty" elastic_mapping:"timestamp: { type: date }"`
}

type LogsProcessor

type LogsProcessor struct {
	// contains filtered or unexported fields
}

func (*LogsProcessor) GetAgentMeta

func (p *LogsProcessor) GetAgentMeta() *event2.AgentMeta

func (*LogsProcessor) Name

func (p *LogsProcessor) Name() string

func (*LogsProcessor) Process

func (p *LogsProcessor) Process(c *pipeline.Context) error

func (*LogsProcessor) ReadJsonLogs

func (p *LogsProcessor) ReadJsonLogs(event FSEvent, c *pipeline.Context)

func (*LogsProcessor) ReadLogs

func (p *LogsProcessor) ReadLogs(event FSEvent, c *pipeline.Context)

func (*LogsProcessor) ReadMultilineLogs

func (p *LogsProcessor) ReadMultilineLogs(event FSEvent, c *pipeline.Context)

func (*LogsProcessor) ReadPlainTextLogs

func (p *LogsProcessor) ReadPlainTextLogs(event FSEvent, c *pipeline.Context)

func (*LogsProcessor) Save

func (p *LogsProcessor) Save(event FSEvent, logContent util.MapStr, timestamp string)

type Node

type Node struct {
	Name string `json:"name"`
	ID   string `json:"id"`
	Port int    `json:"port"`
}

type Operation

type Operation uint8
const (
	OpDone Operation = iota
	OpCreate
	OpWrite
	OpTruncate
)

type Pattern

type Pattern struct {
	Pattern           string      `config:"pattern"`
	Metadata          util.MapStr `config:"metadata"`
	Type              string      `config:"type"`
	LinePattern       string      `config:"line_pattern"`
	RemoveFields      []string    `config:"remove_fields"`
	TimestampFields   []string    `config:"timestamp_fields"`
	TimestampPatterns []string    `config:"timestamp_patterns"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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