promtail

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_TIMEOUT_MS = 5000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.15.0

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

Client is an io.Writer that ships log lines to Loki in batches. Write never waits on the network: lines are buffered and pushed by a background goroutine, and dropped when the buffer is full or the client is closed. Call Close before the process exits to push what is still buffered.

func NewClient added in v1.15.0

func NewClient(params *WithPromtailParams) (*Client, error)

func (*Client) Close added in v1.15.0

func (c *Client) Close(ctx context.Context) error

Close stops accepting lines, pushes the ones already buffered and waits until they are sent or ctx expires. Lines written after Close begins are dropped.

func (*Client) Write added in v1.15.0

func (c *Client) Write(p []byte) (int, error)

Write queues p without blocking and always reports it as written. Lines written once Close has begun are silently dropped.

type Config

type Config struct {
	App      string
	Host     string
	Username string
	Labels   string
	Enabled  bool
	Timeout  int
}

type WithPromtailParams

type WithPromtailParams struct {
	App               string
	Environment       string
	PromtailHost      string
	PromtailUsername  string
	PromtailPassword  string
	PromtailLabels    string
	PromtailEnabled   bool
	PromtailTimeoutMS int
}

func (WithPromtailParams) EffectiveTimeoutMS added in v1.15.0

func (p WithPromtailParams) EffectiveTimeoutMS() int

EffectiveTimeoutMS returns the timeout the client uses for each batch push. The old client applied the timeout to every line, so values below legacyTimeoutThresholdMS are taken as leftovers from it and replaced with the batch default, as is zero.

func (WithPromtailParams) Validate

func (p WithPromtailParams) Validate() error

Validate only requires the Loki connection settings when Promtail is enabled, so apps that don't ship logs can leave them out.

Jump to

Keyboard shortcuts

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