inputfile

package
v0.0.0-...-c13075e Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 18 Imported by: 3

README

gogstash input file

** WARNING ** this module was deprecated, use official tool Filebeat instead.

Synopsis

{
	"input": [
		{
			"type": "file",

			// (required)
			"path": "",

			// (optional), one of ["beginning", "end"], default: "end"
			"start_position": "end",

			// (optional), default: ".sincedb.json"
			"sincedb_path": ".sincedb.json",

			// (optional), in seconds, default: 15
			"sincedb_write_interval": 15
		}
	]
}

Details

  • type
    • Must be "file"
  • path
    • Path of file as input, seperated by line
  • start_position
    • Choose where Logstash starts initially reading files: at the beginning or at the end. The default behavior treats files like live streams and thus starts at the end. If you have old data you want to import, set this to ‘beginning’
  • sincedb_path
    • Where to write the sincedb database (keeps track of the current position of monitored log files).
  • sincedb_write_interval
    • How often (in seconds) to write a since database with the current position of monitored log files.

Documentation

Index

Constants

View Source
const ModuleName = "file"

ModuleName is the name used in config file

Variables

View Source
var (
	ErrorGlobFailed1 = errutil.NewFactory("glob(%q) failed")
)

errors

Functions

func InitHandler

func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeInputConfig, error)

InitHandler initialize the input plugin

Types

type InputConfig

type InputConfig struct {
	config.InputConfig
	Path                 string `json:"path"`
	StartPos             string `json:"start_position,omitempty"` // one of ["beginning", "end"]
	SinceDBPath          string `json:"sincedb_path,omitempty"`
	SinceDBWriteInterval int    `json:"sincedb_write_interval,omitempty"`

	SinceDBInfos map[string]*SinceDBInfo `json:"-"`

	SinceDBLastSaveTime time.Time `json:"-"`
	// contains filtered or unexported fields
}

InputConfig holds the configuration json fields and internal objects

func DefaultInputConfig

func DefaultInputConfig() InputConfig

DefaultInputConfig returns an InputConfig struct with default values

func (*InputConfig) CheckSaveSinceDBInfos

func (t *InputConfig) CheckSaveSinceDBInfos() (err error)

func (*InputConfig) CheckSaveSinceDBInfosLoop

func (t *InputConfig) CheckSaveSinceDBInfosLoop(ctx context.Context) (err error)

func (*InputConfig) LoadSinceDBInfos

func (self *InputConfig) LoadSinceDBInfos() (err error)

func (*InputConfig) SaveSinceDBInfos

func (self *InputConfig) SaveSinceDBInfos() (err error)

func (*InputConfig) Start

func (t *InputConfig) Start(ctx context.Context, msgChan chan<- logevent.LogEvent) (err error)

Start wraps the actual function starting the plugin

type SinceDBInfo

type SinceDBInfo struct {
	Offset int64 `json:"offset,omitempty"`
}

Jump to

Keyboard shortcuts

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