client

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 11 Imported by: ? modules, 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

Overview

Package client builds a Loki client from the connection options logcli takes.

Index

Constants

View Source
const DefaultAddr = "http://localhost:3100"

DefaultAddr is where logcli looks for Loki without an address.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, c *loki.Client) error

Check makes sure the server answers and accepts the credentials, by listing the labels of the last minute, which every Loki and gateway serves.

Types

type Info

type Info struct {
	Addr   string
	Tenant string
	Auth   string // how requests authenticate: basic as a user, a bearer token, or none
}

Info describes the connection for the header.

func New

func New(o Options, userAgent string) (*loki.Client, Info, error)

New builds the client the options describe.

type Options

type Options struct {
	Addr            string
	Username        string
	Password        string
	OrgID           string
	BearerToken     string
	BearerTokenFile string
	AuthHeader      string
	CACert          string
	Cert            string
	Key             string
	TLSSkipVerify   bool
	ServerName      string
}

Options are the connection settings, named after the logcli flags and environment variables.

func OptionsFromEnv

func OptionsFromEnv() Options

OptionsFromEnv reads the environment variables logcli reads.

func (Options) Validate

func (o Options) Validate() error

Validate reports options that cannot work together.

Jump to

Keyboard shortcuts

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