v2

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 6 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultsAndValidate

func AddDefaultsAndValidate(cfg *Config) error

Made this public so it can be called when converting config v1 to config v2.

Types

type Config

type Config struct {
	Global  GlobalConfig  `yaml:",omitempty"`
	Input   InputConfig   `yaml:",omitempty"`
	Grok    GrokConfig    `yaml:",omitempty"`
	Metrics MetricsConfig `yaml:",omitempty"`
	Server  ServerConfig  `yaml:",omitempty"`
}

func Unmarshal

func Unmarshal(config []byte) (*Config, error)

func (*Config) String

func (cfg *Config) String() string

YAML representation, does not include default values.

type GlobalConfig

type GlobalConfig struct {
	ConfigVersion          int           `yaml:"config_version,omitempty"`
	RetentionCheckInterval time.Duration `yaml:"retention_check_interval,omitempty"` // implicitly parsed with time.ParseDuration()
}

type GrokConfig

type GrokConfig struct {
	PatternsDir        string   `yaml:"patterns_dir,omitempty"`
	AdditionalPatterns []string `yaml:"additional_patterns,omitempty"`
}

type InputConfig

type InputConfig struct {
	Type                       string        `yaml:",omitempty"`
	Path                       string        `yaml:",omitempty"`
	FailOnMissingLogfileString string        `yaml:"fail_on_missing_logfile,omitempty"` // cannot use bool directly, because yaml.v2 doesn't support true as default value.
	FailOnMissingLogfile       bool          `yaml:"-"`
	Readall                    bool          `yaml:",omitempty"`
	PollIntervalSeconds        string        `yaml:"poll_interval_seconds,omitempty"` // TODO: Use time.Duration directly
	PollInterval               time.Duration `yaml:"-"`                               // parsed version of PollIntervalSeconds
	MaxLinesInBuffer           int           `yaml:"max_lines_in_buffer,omitempty"`
	WebhookPath                string        `yaml:"webhook_path,omitempty"`
	WebhookFormat              string        `yaml:"webhook_format,omitempty"`
	WebhookJsonSelector        string        `yaml:"webhook_json_selector,omitempty"`
	WebhookTextBulkSeparator   string        `yaml:"webhook_text_bulk_separator,omitempty"`
}

type MetricConfig

type MetricConfig struct {
	Type                 string              `yaml:",omitempty"`
	Name                 string              `yaml:",omitempty"`
	Help                 string              `yaml:",omitempty"`
	Match                string              `yaml:",omitempty"`
	Retention            time.Duration       `yaml:",omitempty"` // implicitly parsed with time.ParseDuration()
	Value                string              `yaml:",omitempty"`
	Cumulative           bool                `yaml:",omitempty"`
	Buckets              []float64           `yaml:",flow,omitempty"`
	Quantiles            map[float64]float64 `yaml:",flow,omitempty"`
	Labels               map[string]string   `yaml:",omitempty"`
	LabelTemplates       []template.Template `yaml:"-"` // parsed version of Labels, will not be serialized to yaml.
	ValueTemplate        template.Template   `yaml:"-"` // parsed version of Value, will not be serialized to yaml.
	DeleteMatch          string              `yaml:"delete_match,omitempty"`
	DeleteLabels         map[string]string   `yaml:"delete_labels,omitempty"` // TODO: Make sure that DeleteMatch is not nil if DeleteLabels are used.
	DeleteLabelTemplates []template.Template `yaml:"-"`                       // parsed version of DeleteLabels, will not be serialized to yaml.
}

func (*MetricConfig) InitTemplates

func (metric *MetricConfig) InitTemplates() error

Made this public so MetricConfig can be initialized in tests.

type MetricsConfig

type MetricsConfig []MetricConfig

type ServerConfig

type ServerConfig struct {
	Protocol string `yaml:",omitempty"`
	Host     string `yaml:",omitempty"`
	Port     int    `yaml:",omitempty"`
	Path     string `yaml:",omitempty"`
	Cert     string `yaml:",omitempty"`
	Key      string `yaml:",omitempty"`
}

Jump to

Keyboard shortcuts

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