promtail

package
v0.0.0-...-a196c27 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultScrapeConfig = ScrapeConfig{
	EntryParser: Docker,
}

DefaultScrapeConfig is the default ScrapeConfig.

Functions

This section is empty.

Types

type Client

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

Client for pushing logs in snappy-compressed protos over HTTP.

func NewClient

func NewClient(cfg ClientConfig, logger log.Logger) (*Client, error)

NewClient makes a new Client.

func (*Client) Handle

func (c *Client) Handle(ls model.LabelSet, t time.Time, s string) error

Handle implement EntryHandler; adds a new line to the next batch; send is async.

func (*Client) Stop

func (c *Client) Stop()

Stop the client.

type ClientConfig

type ClientConfig struct {
	URL       flagext.URLValue
	BatchWait time.Duration
	BatchSize int

	ExternalLabels model.LabelSet `yaml:"external_labels,omitempty"`
}

ClientConfig describes configuration for a HTTP pusher client.

func (*ClientConfig) RegisterFlags

func (c *ClientConfig) RegisterFlags(flags *flag.FlagSet)

RegisterFlags registers flags.

type Config

type Config struct {
	ServerConfig    server.Config   `yaml:"server,omitempty"`
	ClientConfig    ClientConfig    `yaml:"client,omitempty"`
	PositionsConfig PositionsConfig `yaml:"positions,omitempty"`
	ScrapeConfig    []ScrapeConfig  `yaml:"scrape_configs,omitempty"`
}

Config for promtail, describing what files to watch.

func LoadConfig

func LoadConfig(filename string) (*Config, error)

LoadConfig loads config from a file.

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

type EntryHandler

type EntryHandler interface {
	Handle(labels model.LabelSet, time time.Time, entry string) error
}

EntryHandler is something that can "handle" entries.

type EntryHandlerFunc

type EntryHandlerFunc func(labels model.LabelSet, time time.Time, entry string) error

EntryHandlerFunc is modelled on http.HandlerFunc.

func (EntryHandlerFunc) Handle

func (e EntryHandlerFunc) Handle(labels model.LabelSet, time time.Time, entry string) error

Handle implements EntryHandler.

type EntryMiddleware

type EntryMiddleware interface {
	Wrap(next EntryHandler) EntryHandler
}

EntryMiddleware is something that takes on EntryHandler and produces another.

type EntryMiddlewareFunc

type EntryMiddlewareFunc func(next EntryHandler) EntryHandler

EntryMiddlewareFunc is modelled on http.HandlerFunc.

func (EntryMiddlewareFunc) Wrap

Wrap implements EntryMiddleware.

type EntryParser

type EntryParser int

EntryParser describes how to parse log lines.

const (
	Docker EntryParser = iota
	Raw
)

Different supported EntryParsers.

func (*EntryParser) Set

func (e *EntryParser) Set(s string) error

Set implements flag.Value.

func (EntryParser) String

func (e EntryParser) String() string

String returns a string representation of the EnEntryParser.

func (*EntryParser) UnmarshalYAML

func (e *EntryParser) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

func (EntryParser) Wrap

func (e EntryParser) Wrap(next EntryHandler) EntryHandler

Wrap implements EntryMiddleware.

type Positions

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

Positions tracks how far through each file we've read.

func NewPositions

func NewPositions(logger log.Logger, cfg PositionsConfig) (*Positions, error)

NewPositions makes a new Positions.

func (*Positions) Get

func (p *Positions) Get(path string) int64

Get returns how far we've read through a file.

func (*Positions) Put

func (p *Positions) Put(path string, pos int64)

Put records (asynchronously) how far we've read through a file.

func (*Positions) Remove

func (p *Positions) Remove(path string)

Remove removes the position tracking for a filepath

func (*Positions) Stop

func (p *Positions) Stop()

Stop the Position tracker.

type PositionsConfig

type PositionsConfig struct {
	SyncPeriod    time.Duration `yaml:"sync_period"`
	PositionsFile string        `yaml:"filename"`
}

PositionsConfig describes where to get postition information from.

func (*PositionsConfig) RegisterFlags

func (cfg *PositionsConfig) RegisterFlags(flags *flag.FlagSet)

RegisterFlags register flags.

type Promtail

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

Promtail is the root struct for Promtail...

func New

func New(cfg Config) (*Promtail, error)

New makes a new Promtail.

func (*Promtail) Run

func (p *Promtail) Run() error

Run the promtail; will block until a signal is received.

func (*Promtail) Shutdown

func (p *Promtail) Shutdown()

Shutdown the promtail.

type ScrapeConfig

type ScrapeConfig struct {
	JobName                string                           `yaml:"job_name,omitempty"`
	EntryParser            EntryParser                      `yaml:"entry_parser"`
	RelabelConfigs         []*relabel.Config                `yaml:"relabel_configs,omitempty"`
	ServiceDiscoveryConfig sd_config.ServiceDiscoveryConfig `yaml:",inline"`
}

ScrapeConfig describes a job to scrape.

func (*ScrapeConfig) UnmarshalYAML

func (c *ScrapeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Target

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

Target describes a particular set of logs.

func NewTarget

func NewTarget(logger log.Logger, handler EntryHandler, positions *Positions, path string, labels model.LabelSet) (*Target, error)

NewTarget create a new Target.

func (*Target) Stop

func (t *Target) Stop()

Stop the target.

type TargetManager

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

TargetManager manages a set of targets.

func NewTargetManager

func NewTargetManager(
	logger log.Logger,
	positions *Positions,
	client EntryHandler,
	scrapeConfig []ScrapeConfig,
) (*TargetManager, error)

NewTargetManager creates a new TargetManager.

func (*TargetManager) Stop

func (tm *TargetManager) Stop()

Stop the TargetManager.

Jump to

Keyboard shortcuts

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