file

package
v0.0.0-...-bf621fb Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "file"

Variables

This section is empty.

Functions

func IsNotExist

func IsNotExist(path string) bool

func New

func New(cfg *config.ConfigRaw, common *config.Common) (input.Input, error)

Types

type Config

type Config struct {
	input.Config

	Path       string      `hcl:"path" yaml:"path" json:"path"`                      // path glob
	ReadBuffer config.Size `hcl:"read_buffer" yaml:"read_buffer" json:"read_buffer"` // read buffer size
	Codec      string      `hcl:"codec" yaml:"codec" json:"codec"`                   // codec name (deefault - line)
	// Username string        `hcl:"username" yaml:"username"`
	// Pasword  string        `hcl:"usernam" yaml:"username"`
	Interval time.Duration `hcl:"interval" yaml:"interval" json:"interval"`
	// mode = tail If no file record in seek db, no shutdown on io.EOF.  If no file record in seek db, depend on start_end
	// mode = read If no file record in seek db, read from start and exit on io.OEF (for completed files), start_end is ignored
	Mode     Mode   `hcl:"mode" yaml:"mode" json:"mode"`
	StartEnd bool   `hcl:"start_end" yaml:"start_end" json:"start_end"` // read from end  if no file record in seek db
	SeekFile string `hcl:"seek_file" yaml:"seek_file" json:"seek_file"` // if not set, read from end after start

}

type File

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

File is file input reader.

In some cases (partial write to file during log rotate) can read incomplete line.

So use proper codec with format check (better, don't fire event) or do post validate in filters (slower)

func (*File) Name

func (in *File) Name() string

func (*File) Start

func (in *File) Start(ctx context.Context, outChan chan<- *event.Event) error

type Mode

type Mode int8
const (
	ModeTail Mode = iota
	ModeRead
)

func (*Mode) Set

func (m *Mode) Set(value string) error

func (*Mode) String

func (m *Mode) String() string

func (*Mode) UnmarshalYAML

func (m *Mode) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML for use Aggregation in yaml files

Jump to

Keyboard shortcuts

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