loki

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package loki implements Loki logs support for the Grafana Cloud Agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled            bool              `yaml:"-"`
	PositionsDirectory string            `yaml:"positions_directory"`
	Configs            []*InstanceConfig `yaml:"configs"`
}

Config controls the configuration of the Loki log scraper.

func (*Config) ApplyDefaults added in v0.12.0

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.

func (*Config) UnmarshalYAML

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

type Instance added in v0.13.0

type Instance struct {
	// contains filtered or unexported fields
}

Instance is an individual Loki instance.

func NewInstance added in v0.13.0

func NewInstance(reg prometheus.Registerer, c *InstanceConfig, l log.Logger) (*Instance, error)

NewInstance creates and starts a Loki instance.

func (*Instance) ApplyConfig added in v0.13.0

func (i *Instance) ApplyConfig(c *InstanceConfig) error

ApplyConfig will apply a new InstanceConfig. If the config hasn't changed, then nothing will happen, otherwise the old Promtail will be stopped and then replaced with a new one.

func (*Instance) Stop added in v0.13.0

func (i *Instance) Stop()

type InstanceConfig added in v0.12.0

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"`
}

InstanceConfig is an individual Promtail config.

func (*InstanceConfig) UnmarshalYAML added in v0.12.0

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

type Loki

type Loki struct {
	// contains filtered or unexported fields
}

func New

func New(reg prometheus.Registerer, c Config, l log.Logger) (*Loki, error)

New creates and starts Loki log collection.

func (*Loki) ApplyConfig added in v0.13.0

func (l *Loki) ApplyConfig(c Config) error

ApplyConfig updates Loki with a new Config.

func (*Loki) Stop

func (l *Loki) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳