log

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mode

func Mode(m string) string

Mode translates the mode to lokis terminology.

func NewFake

func NewFake(t *testing.T, expectedTime time.Time, expectedLines ...string) *fake

func StdOut

func StdOut(mode string) (output.LogOutput, error)

StdOut sets up an stdout log output with the specified mode.

Types

type Client

type Client struct {
	logclient.Client
	StdOut output.LogOutput
}

func NewClient

func NewClient(address, token, orgID string, insecure bool) (*Client, error)

NewClient returns a new log API client.

func (*Client) QueryRange

func (c *Client) QueryRange(ctx context.Context, out output.LogOutput, q Query) error

QueryRange queries logs within a specific time range.

func (*Client) QueryRangeWithRetry added in v1.2.6

func (c *Client) QueryRangeWithRetry(ctx context.Context, out output.LogOutput, q Query) error

QueryRangeWithRetry queries logs within a specific time range with a retry in case of an error or not finding any logs.

func (*Client) TailQuery

func (c *Client) TailQuery(ctx context.Context, delayFor time.Duration, out output.LogOutput, q Query) error

TailQuery tails logs using the loki websocket endpoint. This has been adapted from https://github.com/grafana/loki/blob/v2.8.2/pkg/logcli/query/tail.go#L22 as it directly prints out messages using builtin log, which we don't want.

type Query

type Query struct {
	QueryString string
	Start       time.Time
	End         time.Time
	Limit       int
	Step        time.Duration
	Interval    time.Duration
	Quiet       bool
	Direction   logproto.Direction
}

Jump to

Keyboard shortcuts

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