promtail

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const LogChanSize = 5000

LogChanSize default chan size

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Debugf(format string, args ...interface{})
	// Infof(format string, args ...interface{})
	// Warnf(format string, args ...interface{})
	// Errorf(format string, args ...interface{})
	// LogWithLabels write logs without Log level but with labels
	LogWithLabels(lables map[string]string, level LogLevel, line string)
	Shutdown()
}

Client client interface

func NewClientJSON added in v0.1.3

func NewClientJSON(conf ClientConfig) (Client, error)

NewClientJSON client with JSON

type ClientConfig

type ClientConfig struct {
	// E.g. http://localhost:3100/api/prom/push
	PushURL string
	// E.g. "{job=\"somejob\"}"
	// Labels             string
	BatchWait          time.Duration
	BatchEntriesNumber int
	// Logs are sent to Promtail if the entry level is >= SendLevel
	SendLevel LogLevel
	// Logs are printed to stdout if the entry level is >= PrintLevel
	PrintLevel LogLevel
	// MaxRetry enabled retry, default disabled, 0
	MaxRetry int
	// RetryMinWait, default 1s
	RetryMinWait time.Duration
	// RetryMaxWait default 30s
	RetryMaxWait time.Duration
}

ClientConfig new config: MaxRetry

type ClientJSON added in v0.1.3

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

ClientJSON client with JSON format

func (*ClientJSON) LogWithLabels added in v0.1.3

func (c *ClientJSON) LogWithLabels(lables map[string]string, level LogLevel, line string)

func (*ClientJSON) Shutdown added in v0.1.3

func (c *ClientJSON) Shutdown()

type LogLevel

type LogLevel int

LogLevel level for log

const (
	//DEBUG debug
	DEBUG LogLevel = iota
	//INFO default level
	INFO LogLevel = iota
	//WARN warning
	WARN LogLevel = iota
	//ERROR error only
	ERROR LogLevel = iota
	//DISABLE Maximum level, disables sending or printing
	DISABLE LogLevel = iota
)

Jump to

Keyboard shortcuts

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