loki

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfiguration added in v1.7.4

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

type Configuration added in v1.7.4

type Configuration 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                              AuthConfiguration `yaml:"auth"`
	MaxFailureDuration                time.Duration     `yaml:"max_failure_duration"` // Max duration of failure before stopping the source
	NoReadyCheck                      bool              `yaml:"no_ready_check"`       // Bypass /ready check before starting
	configuration.DataSourceCommonCfg `yaml:",inline"`
}

type Data

type Data struct {
	ResultType string         `json:"resultType"`
	Result     []StreamResult `json:"result"` // Warning, just stream value is handled
	Stats      any            `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 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 Source added in v1.7.4

type Source struct {
	Config Configuration

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

func (*Source) CanRun added in v1.7.4

func (*Source) CanRun() error

func (*Source) Configure added in v1.7.4

func (l *Source) Configure(_ context.Context, config []byte, logger *log.Entry, metricsLevel metrics.AcquisitionMetricsLevel) error

func (*Source) ConfigureByDSN added in v1.7.4

func (l *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error

func (*Source) Dump added in v1.7.4

func (l *Source) Dump() any

func (*Source) GetAggregMetrics added in v1.7.4

func (*Source) GetAggregMetrics() []prometheus.Collector

func (*Source) GetMetrics added in v1.7.4

func (*Source) GetMetrics() []prometheus.Collector

func (*Source) GetMode added in v1.7.4

func (l *Source) GetMode() string

func (*Source) GetName added in v1.7.4

func (*Source) GetName() string

func (*Source) GetUuid added in v1.7.4

func (l *Source) GetUuid() string

func (*Source) OneShotAcquisition added in v1.7.4

func (l *Source) OneShotAcquisition(ctx context.Context, out chan pipeline.Event, t *tomb.Tomb) error

OneShotAcquisition reads a set of file and returns when done

func (*Source) StreamingAcquisition added in v1.7.4

func (l *Source) StreamingAcquisition(ctx context.Context, out chan pipeline.Event, t *tomb.Tomb) error

func (*Source) UnmarshalConfig added in v1.7.4

func (l *Source) 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