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: 0

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