loki

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ResultType string         `json:"resultType"`
	Result     []StreamResult `json:"result"` // Warning, just stream value is handled
	Stats      interface{}    `json:"stats"`  // Stats is boring, just ignore it
}

type DroppedEntry

type DroppedEntry struct {
	Labels    map[string]string `json:"labels"`
	Timestamp time.Time         `json:"timestamp"`
}

type Entry

type Entry struct {
	Timestamp time.Time
	Line      string
}

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(b []byte) error

type LokiAuthConfiguration

type LokiAuthConfiguration struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type LokiConfiguration

type LokiConfiguration struct {
	URL                               string                `yaml:"url"`    // Loki url
	Prefix                            string                `yaml:"prefix"` // Loki prefix
	Query                             string                `yaml:"query"`  // LogQL query
	Limit                             int                   `yaml:"limit"`  // Limit of logs to read
	DelayFor                          time.Duration         `yaml:"delay_for"`
	Since                             time.Duration         `yaml:"since"`
	Headers                           map[string]string     `yaml:"headers"`        // HTTP headers for talking to Loki
	WaitForReady                      time.Duration         `yaml:"wait_for_ready"` // Retry interval, default is 10 seconds
	Auth                              LokiAuthConfiguration `yaml:"auth"`
	MaxFailureDuration                time.Duration         `yaml:"max_failure_duration"` // Max duration of failure before stopping the source
	configuration.DataSourceCommonCfg `yaml:",inline"`
}

type LokiQuery

type LokiQuery struct {
	Status string `json:"status"`
	Data   Data   `json:"data"`
}

LokiQuery GET response. See https://grafana.com/docs/loki/latest/api/#get-lokiapiv1query

type LokiSource

type LokiSource struct {
	Config LokiConfiguration

	Client *lokiclient.LokiClient
	// contains filtered or unexported fields
}

func (*LokiSource) CanRun

func (l *LokiSource) CanRun() error

func (*LokiSource) Configure

func (l *LokiSource) Configure(config []byte, logger *log.Entry, MetricsLevel int) error

func (*LokiSource) ConfigureByDSN

func (l *LokiSource) ConfigureByDSN(dsn string, labels map[string]string, logger *log.Entry, uuid string) error

func (*LokiSource) Dump

func (l *LokiSource) Dump() interface{}

func (*LokiSource) GetAggregMetrics

func (l *LokiSource) GetAggregMetrics() []prometheus.Collector

func (*LokiSource) GetMetrics

func (l *LokiSource) GetMetrics() []prometheus.Collector

func (*LokiSource) GetMode

func (l *LokiSource) GetMode() string

func (*LokiSource) GetName

func (l *LokiSource) GetName() string

func (*LokiSource) GetUuid

func (l *LokiSource) GetUuid() string

func (*LokiSource) OneShotAcquisition

func (l *LokiSource) OneShotAcquisition(out chan types.Event, t *tomb.Tomb) error

OneShotAcquisition reads a set of file and returns when done

func (*LokiSource) StreamingAcquisition

func (l *LokiSource) StreamingAcquisition(out chan types.Event, t *tomb.Tomb) error

func (*LokiSource) SupportedModes

func (l *LokiSource) SupportedModes() []string

SupportedModes returns the supported modes by the acquisition module

func (*LokiSource) UnmarshalConfig

func (l *LokiSource) UnmarshalConfig(yamlConfig []byte) error

type Stream

type Stream struct {
	Stream  map[string]string `json:"stream"`
	Entries []Entry           `json:"values"`
}

type StreamResult

type StreamResult struct {
	Stream map[string]string `json:"stream"`
	Values []Entry           `json:"values"`
}

type Tail

type Tail struct {
	Streams        []Stream       `json:"streams"`
	DroppedEntries []DroppedEntry `json:"dropped_entries"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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