file

package
v0.5.15 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory() (pipeline.AnyPlugin, pipeline.AnyConfig)

Types

type Config

type Config struct {
	//> File name for log file.
	//> defaultTargetFileName = TargetFile default value
	TargetFile string `json:"target_file" default:"/var/log/file-d.log"` //*

	//> Interval of creation new file
	RetentionInterval  cfg.Duration `json:"retention_interval" default:"1h" parse:"duration"` //*
	RetentionInterval_ time.Duration

	//> Layout is added to targetFile after sealing up. Determines result file name
	Layout string `json:"time_layout" default:"01-02-2006_15:04:05"` //*

	//> How much workers will be instantiated to send batches.
	WorkersCount  cfg.Expression `json:"workers_count" default:"gomaxprocs*4" parse:"expression"` //*
	WorkersCount_ int

	//> Maximum quantity of events to pack into one batch.
	BatchSize  cfg.Expression `json:"batch_size" default:"capacity/4" parse:"expression"` //*
	BatchSize_ int

	//> @3@4@5@6
	//>
	//> A minimum size of events in a batch to send.
	//> If both batch_size and batch_size_bytes are set, they will work together.
	BatchSizeBytes  cfg.Expression `json:"batch_size_bytes" default:"0" parse:"expression"` //*
	BatchSizeBytes_ int

	//> After this timeout batch will be sent even if batch isn't completed.
	BatchFlushTimeout  cfg.Duration `json:"batch_flush_timeout" default:"1s" parse:"duration"` //*
	BatchFlushTimeout_ time.Duration

	//> File mode for log files
	FileMode  cfg.Base8 `json:"file_mode" default:"0666" parse:"base8"` //*
	FileMode_ int64
}

type Plugable

type Plugable interface {
	Start(config pipeline.AnyConfig, params *pipeline.OutputPluginParams)
	Out(event *pipeline.Event)
	Stop()
}

type Plugin

type Plugin struct {
	SealUpCallback func(string)
	// contains filtered or unexported fields
}

func (*Plugin) Out

func (p *Plugin) Out(event *pipeline.Event)

func (*Plugin) Start

func (p *Plugin) Start(config pipeline.AnyConfig, params *pipeline.OutputPluginParams)

func (*Plugin) Stop

func (p *Plugin) Stop()

type Plugins

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

Plugins is an abstraction upon multiple file.Plugin, which helps reuse it.

func NewFilePlugins

func NewFilePlugins(plugins map[string]Plugable) *Plugins

func (*Plugins) Add

func (p *Plugins) Add(plugName string, plug Plugable)

Add new plugin to plugs.

func (*Plugins) Exists

func (p *Plugins) Exists(plugName string) (exists bool)

Exists asks if such file.Plugin exists in Plugins.

func (*Plugins) IsDynamic

func (p *Plugins) IsDynamic(PlugName string) bool

IsDynamic tells is plugin created from events.

func (*Plugins) IsStatic

func (p *Plugins) IsStatic(plugName string) bool

IsStatic tells is plugin created from config.

func (*Plugins) Out

func (p *Plugins) Out(event *pipeline.Event, selector pipeline.PluginSelector)

func (*Plugins) Start

func (p *Plugins) Start(starterData pipeline.PluginsStarterMap)

Start runs all plugins.

func (*Plugins) Stop

func (p *Plugins) Stop()

Stop stops all plugins (very useful comment).

Jump to

Keyboard shortcuts

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