stanzareceiver

package module
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

README

Stanza Receiver

Tails and parses logs from a wide variety of sources using the opentelemetry-log-collection library.

Supported pipeline types: logs

🚧 This receiver is in alpha and configuration fields are subject to change.

Input Sources

Stanza supports pre-defined log sources for dozens of specific technologies.

It can also be easily configured to tail and parse any structured or unstructured log file, Windows Event Log, and journald. It can also receive arbitrary logs via TCP and UDP.

Required Parameters

  • operators is an array of operators. Each operator performs a simple responsibility, such as reading from a file, or parsing JSON. Chain together operators to process logs into a desired format.

Optional Parameters

  • plugin_dir is the path to a directory which contains stanza plugins. Plugins are parameterized pipelines that are designed for specific use cases.
  • offsets_file is the path to a file that stanza will use to remember where it left off when reading from files or other persistent input sources. If specified, stanza will create and manage this file.

Operator Basics

  • Every operator has a type.
  • Every operator can be given a unique id. If you use the same type of operator more than once in a pipeline, you must specify an id. Otherwise, the id defaults to the value of type.
  • Operators will output to the next operator in the pipeline. The last operator in the pipeline will emit from the receiver. Optionally, the output parameter can be used to specify the id of another operator to which logs will be passed directly.

Additional Terminology and Features

  • An entry is the base representation of log data as it moves through a pipeline. All operators either create, modify, or consume entries.
  • A field is used to reference values in an entry.
  • A common expression syntax is used in several operators. For example, expressions can be used to filter or route entries.
  • timestamp parsing is available as a block within all parser operators, and also as a standalone operator. Many common timestamp layouts are supported.
  • severity parsing is available as a block within all parser operators, and also as a standalone operator. Stanza uses a flexible severity representation which is automatically interpreted by the stanza receiver.

Example - Tailing a simple json file

Receiver Configuration

receivers:
  stanza:
    operators:
      - type: file_input
        include: [ /var/log/myservice/*.json ]
      - type: json_parser
        timestamp:
          parse_from: time
          layout: '%Y-%m-%d %H:%M:%S'

Documentation

Overview

Package stanzareceiver implements a receiver that can be used by the Opentelemetry collector to receive logs using the stanza log agent

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() component.ReceiverFactory

NewFactory creates a factory for Stanza receiver

Types

type Config

type Config struct {
	configmodels.ReceiverSettings `mapstructure:",squash"`
	OffsetsFile                   string         `mapstructure:"offsets_file"`
	PluginDir                     string         `mapstructure:"plugin_dir"`
	Operators                     OperatorConfig `mapstructure:"operators"`
}

Config defines configuration for the stanza receiver

type LogEmitter added in v0.12.0

type LogEmitter struct {
	helper.OutputOperator
	// contains filtered or unexported fields
}

LogEmitter is a stanza operator that emits log entries to a channel

func NewLogEmitter added in v0.12.0

func NewLogEmitter(logger *zap.SugaredLogger) *LogEmitter

NewLogEmitter creates a new receiver output

func (*LogEmitter) Process added in v0.12.0

func (e *LogEmitter) Process(ctx context.Context, ent *entry.Entry) error

Process will emit an entry to the output channel

func (*LogEmitter) Stop added in v0.12.0

func (e *LogEmitter) Stop() error

Stop will close the log channel

type OperatorConfig added in v0.15.0

type OperatorConfig []map[string]interface{}

func (OperatorConfig) IntoPipelineConfig added in v0.15.0

func (r OperatorConfig) IntoPipelineConfig() (pipeline.Config, error)

Jump to

Keyboard shortcuts

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