Documentation ¶
Overview ¶
Package logs implements logs support for the Grafana Agent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { PositionsDirectory string `yaml:"positions_directory,omitempty"` Configs []*InstanceConfig `yaml:"configs,omitempty"` }
Config controls the configuration of the Loki log scraper.
func (*Config) ApplyDefaults ¶
ApplyDefaults applies defaults to the Config and ensures that it is valid.
Validations:
- No two InstanceConfigs may have the same name.
- No two InstanceConfigs may have the same positions path.
- No InstanceConfig may have an empty name.
- If InstanceConfig positions path is empty, shared PositionsDirectory must not be empty.
Defaults:
- If a positions config is empty, it will be generated based on the InstanceConfig name and Config.PositionsDirectory.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is an individual Logs instance.
func NewInstance ¶
func NewInstance(reg prometheus.Registerer, c *InstanceConfig, l log.Logger) (*Instance, error)
NewInstance creates and starts a Logs instance.
func (*Instance) ApplyConfig ¶
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.
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"` }
InstanceConfig is an individual Promtail config.
func (*InstanceConfig) UnmarshalYAML ¶
func (c *InstanceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements yaml.Unmarshaler.
type Logs ¶
type Logs struct {
// contains filtered or unexported fields
}
Logs is a Logs log collection. It uses multiple distinct sets of Logs Promtail agents to collect logs and send them to a Logs server.
func New ¶
func New(reg prometheus.Registerer, c *Config, l log.Logger) (*Logs, error)
New creates and starts Loki log collection.
func (*Logs) ApplyConfig ¶
ApplyConfig updates Logs with a new Config.