file

package
v0.82.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: BSD-3-Clause Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

File output

It sends event batches into files.

Config params

target_file string default=/var/log/file-d.log

File path to write events to. Each rotated file will be named with current unix timestamp.

For example, if target_file is /var/log/file-d.log file will be /var/log/1893445200_file-d.log


retention_interval cfg.Duration default=1h

How often to rotate a particular file.


time_layout string default=01-02-2006_15:04:05

Layout is added to targetFile after sealing up. Determines result file name


workers_count cfg.Expression default=gomaxprocs*4

How much workers will be instantiated to send batches.


batch_size cfg.Expression default=capacity/4

Maximum quantity of events to pack into one batch.


batch_size_bytes cfg.Expression default=0

A minimum size of events in a batch to send. If both batch_size and batch_size_bytes are set, they will work together.


batch_flush_timeout cfg.Duration default=1s

After this timeout batch will be sent even if batch isn't completed.


file_mode cfg.Base8 default=0666

File mode for log files



Generated using insane-doc

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 {
	// > @3@4@5@6
	// >
	// > File path to write events to.
	// > Each rotated file will be named with current unix timestamp.
	// >
	// > For example, if `target_file` is `/var/log/file-d.log`
	// > file will be `/var/log/1893445200_file-d.log`
	TargetFile string `json:"target_file" default:"/var/log/file-d.log"` // *

	// > @3@4@5@6
	// >
	// > How often to rotate a particular file.
	RetentionInterval  cfg.Duration `json:"retention_interval" default:"1h" parse:"duration"` // *
	RetentionInterval_ time.Duration

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

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

	// > @3@4@5@6
	// >
	// > 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

	// > @3@4@5@6
	// >
	// > 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

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

! config-params ^ config-params

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