Help us shape the future of Go! Take the 2026 Go Developer Survey

logs

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package logs holds the production controlplane.LogsQuerier adapters — the seam burrowd uses to query an installed or connected logs backing service (ADR-0026). VictoriaLogs is the first. It lives under controlplane/ (not controlplane/internal) so cmd/burrowd can wire it; it is licensed Apache-2.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loki

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

Loki queries a Grafana Loki store over its HTTP query API (AGPL-3.0). Burrow connects to an existing Loki the user already runs and queries it — it never distributes Loki, so its license does not constrain this adapter (ADR-0026). The store's in-cluster endpoint (host:port) is passed per query, along with an optional bearer token for an authenticated Loki.

func NewLoki

func NewLoki(hc *http.Client) Loki

NewLoki returns a Loki querier using hc (defaulting to http.DefaultClient).

func (Loki) QueryLogs

func (l Loki) QueryLogs(ctx context.Context, endpoint, query string, limit int, token string) ([]controlplane.LogEntry, error)

QueryLogs runs a LogQL query against the Loki at endpoint and returns up to limit records. Loki rejects an empty selector, so an empty caller query defaults to `{job=~".+"}` ("everything") so a plain "show me logs" works. Results come back direction=backward (newest-first per stream); we flatten across streams and cap at limit. Ordering caveat: a simple concatenation across multiple streams is not globally time-sorted — entries are newest-first within each stream but streams are concatenated in Loki's response order, which is acceptable for the agent's troubleshooting use. A non-empty token is sent as an Authorization: Bearer header for an authenticated Loki.

type VictoriaLogs

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

VictoriaLogs queries a VictoriaLogs store over its HTTP LogsQL API (Apache-2.0). The store's in-cluster endpoint (host:port) is passed per query — burrowd reaches it directly, in-cluster. An optional bearer token is supported for an authenticated store; the in-cluster install passes "" (unauthenticated).

func NewVictoriaLogs

func NewVictoriaLogs(hc *http.Client) VictoriaLogs

NewVictoriaLogs returns a VictoriaLogs querier using hc (defaulting to http.DefaultClient).

func (VictoriaLogs) QueryLogs

func (v VictoriaLogs) QueryLogs(ctx context.Context, endpoint, query string, limit int, token string) ([]controlplane.LogEntry, error)

QueryLogs runs a LogsQL query against the store at endpoint and returns up to limit records. VictoriaLogs answers /select/logsql/query as newline-delimited JSON, one object per record with _time and _msg fields; an empty query matches everything. A non-empty token is sent as an Authorization: Bearer header for an authenticated store.

Jump to

Keyboard shortcuts

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