file

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 10 Imported by: 16

README

File Output Plugin

This plugin writes telegraf metrics to files

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the CONFIGURATION.md for more details.

Configuration

# Send telegraf metrics to file(s)
[[outputs.file]]
  ## Files to write to, "stdout" is a specially handled file.
  files = ["stdout", "/tmp/metrics.out"]

  ## Use batch serialization format instead of line based delimiting.  The
  ## batch format allows for the production of non line based output formats and
  ## may more efficiently encode and write metrics.
  # use_batch_format = false

  ## The file will be rotated after the time interval specified.  When set
  ## to 0 no time based rotation is performed.
  # rotation_interval = "0h"

  ## The logfile will be rotated when it becomes larger than the specified
  ## size.  When set to 0 no size based rotation is performed.
  # rotation_max_size = "0MB"

  ## Maximum number of rotated archives to keep, any older logs are deleted.
  ## If set to -1, no archives are removed.
  # rotation_max_archives = 5

  ## Data format to output.
  ## 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_OUTPUT.md
  data_format = "influx"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Files               []string        `toml:"files"`
	RotationInterval    config.Duration `toml:"rotation_interval"`
	RotationMaxSize     config.Size     `toml:"rotation_max_size"`
	RotationMaxArchives int             `toml:"rotation_max_archives"`
	UseBatchFormat      bool            `toml:"use_batch_format"`
	Log                 telegraf.Logger `toml:"-"`
	// contains filtered or unexported fields
}

func (*File) Close

func (f *File) Close() error

func (*File) Connect

func (f *File) Connect() error

func (*File) SampleConfig

func (*File) SampleConfig() string

func (*File) SetSerializer

func (f *File) SetSerializer(serializer serializers.Serializer)

func (*File) Write

func (f *File) Write(metrics []telegraf.Metric) error

Jump to

Keyboard shortcuts

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