dirmon

package
v0.0.0-...-12ddfe4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 20 Imported by: 0

README

tail Input Plugin

The tail plugin "tails" a logfile and parses each log message.

By default, the tail plugin acts like the following unix tail command:

tail -F --lines=0 myfile.log
  • -F means that it will follow the name of the given file, so that it will be compatible with log-rotated files, and that it will retry on inaccessible files.
  • --lines=0 means that it will start at the end of the file (unless the from_beginning option is set).

see http://man7.org/linux/man-pages/man1/tail.1.html for more details.

The plugin expects messages in one of the Telegraf Input Data Formats.

Configuration:
# Stream a log file, like the tail -f command
[[inputs.tail]]
  ## files to tail.
  ## These accept standard unix glob matching rules, but with the addition of
  ## ** as a "super asterisk". ie:
  ##   "/var/log/**.log"  -> recursively find all .log files in /var/log
  ##   "/var/log/*/*.log" -> find all .log files with a parent dir in /var/log
  ##   "/var/log/apache.log" -> just tail the apache log file
  ##
  ## See https://github.com/gobwas/glob for more examples
  ##
  files = ["/var/mymetrics.out"]
  ## Read file from beginning.
  from_beginning = false
  ## Whether file is a named pipe
  pipe = false

  ## Method used to watch for file updates.  Can be either "inotify" or "poll".
  # watch_method = "inotify"

  ## Data format to consume.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
  data_format = "influx"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashID

func HashID(metric telegraf.Metric) uint64

Types

type DirDefObject

type DirDefObject struct {
	Directory      string
	DirInclude     []string
	DirExclude     []string
	FileInclude    []string
	FileExclude    []string
	NumProcessors  int
	FieldReplace   map[string]string
	FileRegex      map[string]string
	FileTagRegex   map[string]string
	MetricTagRegex map[string]string
	TempExtension  string
	// contains filtered or unexported fields
}

func (DirDefObject) AddToRtQueue

func (ddo DirDefObject) AddToRtQueue(fileName string)

func (DirDefObject) FileProcessor

func (ddo DirDefObject) FileProcessor(id int)

func (DirDefObject) HistoryHandler

func (ddo DirDefObject) HistoryHandler(dir string, files []string)

func (*DirDefObject) IsDirExclude

func (ddo *DirDefObject) IsDirExclude(strMatch string) bool

func (*DirDefObject) IsDirInclude

func (ddo *DirDefObject) IsDirInclude(strMatch string) bool

func (*DirDefObject) IsDirMatch

func (ddo *DirDefObject) IsDirMatch(strMatch string) bool

func (*DirDefObject) IsFileExclude

func (ddo *DirDefObject) IsFileExclude(strMatch string) bool

func (*DirDefObject) IsFileInclude

func (ddo *DirDefObject) IsFileInclude(strMatch string) bool

func (*DirDefObject) IsFileMatch

func (ddo *DirDefObject) IsFileMatch(strMatch string) bool

func (*DirDefObject) OSReadDir

func (ddo *DirDefObject) OSReadDir(root string) (map[string][]string, error)

func (*DirDefObject) ProcessFile

func (ddo *DirDefObject) ProcessFile(id int, fileName string, acc telegraf.Accumulator) error

func (DirDefObject) RealtimeHandler

func (ddo DirDefObject) RealtimeHandler(dir string)

func (DirDefObject) Start

func (ddo DirDefObject) Start(acc telegraf.Accumulator, parser parsers.Parser, gFieldReplace map[string]string) error

type DirMon

type DirMon struct {
	Directory    []DirDefObject
	FieldReplace map[string]string

	parsers.Parser
	// contains filtered or unexported fields
}

func (*DirMon) Description

func (dm *DirMon) Description() string

func (*DirMon) Gather

func (dm *DirMon) Gather(_ telegraf.Accumulator) error

func (*DirMon) SampleConfig

func (dm *DirMon) SampleConfig() string

func (*DirMon) SetParser

func (dm *DirMon) SetParser(p parsers.Parser)

func (*DirMon) Start

func (dm *DirMon) Start(acc telegraf.Accumulator) error

func (*DirMon) Stop

func (dm *DirMon) Stop()

Jump to

Keyboard shortcuts

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