logs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package logs holds types for the logging subsystem of Grafana Agent static mode.

Index

Constants

This section is empty.

Variables

View Source
var DefaultGlobalConfig = GlobalConfig{
	ClientConfigs: []client.Config{},
	FileWatch: file.WatchConfig{
		MinPollFrequency: 250 * time.Millisecond,
		MaxPollFrequency: 250 * time.Millisecond,
	},
}

DefaultGlobalConfig holds default global settings to be used across all instances.

Functions

func DefaultConfig

func DefaultConfig() config.Config

DefaultConfig returns a default config for a Logs instance.

Types

type Config

type Config struct {
	PositionsDirectory string            `yaml:"positions_directory,omitempty"`
	Global             GlobalConfig      `yaml:"global,omitempty"`
	Configs            []*InstanceConfig `yaml:"configs,omitempty"`
}

Config controls the configuration of the Loki log scraper.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults() error

ApplyDefaults applies defaults to the Config and ensures that it is valid.

Validations:

  1. No two InstanceConfigs may have the same name.
  2. No two InstanceConfigs may have the same positions path.
  3. No InstanceConfig may have an empty name.
  4. If InstanceConfig positions path is empty, shared PositionsDirectory must not be empty.

Defaults:

  1. If a positions config is empty, it will be generated based on the InstanceConfig name and Config.PositionsDirectory.
  2. If an InstanceConfigs's ClientConfigs is empty, it will be generated based on the Config.GlobalConfig.ClientConfigs.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type GlobalConfig

type GlobalConfig struct {
	FileWatch     file.WatchConfig `yaml:"file_watch_config,omitempty"`
	ClientConfigs []client.Config  `yaml:"clients,omitempty"`
}

GlobalConfig holds global settings that apply to all instances by default.

func (GlobalConfig) IsZero

func (c GlobalConfig) IsZero() bool

func (*GlobalConfig) UnmarshalYAML

func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type InstanceConfig

type InstanceConfig struct {
	Name string `yaml:"name,omitempty"`

	ClientConfigs   []client.Config       `yaml:"clients,omitempty"`
	PositionsConfig positions.Config      `yaml:"positions,omitempty"`
	ScrapeConfig    []scrapeconfig.Config `yaml:"scrape_configs,omitempty"`
	TargetConfig    file.Config           `yaml:"target_config,omitempty"`
	LimitsConfig    limit.Config          `yaml:"limits_config,omitempty"`
}

InstanceConfig is an individual Promtail config.

func (*InstanceConfig) Initialize

func (c *InstanceConfig) Initialize()

func (*InstanceConfig) UnmarshalYAML

func (c *InstanceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

Jump to

Keyboard shortcuts

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