loki

package
v0.1.0-latest-stable Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides methods to query Loki via Kubernetes service proxy

func NewClient

func NewClient(restClient *rest.RESTClient, namespace string) *Client

NewClient creates a new Loki client

func (*Client) QueryLogs

func (c *Client) QueryLogs(ctx context.Context, searchTerm string, labels map[string]string, lookback time.Duration) ([]LogEntry, error)

QueryLogs performs a log search with multiple label filters

type LogEntry

type LogEntry struct {
	Timestamp time.Time
	Line      string
	Stream    map[string]string
}

LogEntry represents a single log entry returned by Loki

type QueryResponse

type QueryResponse struct {
	Status string `json:"status"`
	Data   struct {
		ResultType string `json:"resultType"`
		Result     []struct {
			Stream map[string]string `json:"stream"`
			Values [][]string        `json:"values"` // [timestamp, log line]
		} `json:"result"`
	} `json:"data"`
}

QueryResponse represents the response from Loki's query_range endpoint

Jump to

Keyboard shortcuts

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