Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Defaults = Config{ ConfigFile: "config.yaml", BufferSize: 1000, WorkerCount: 0, Preset: "simple", Debug: Debug{}, Log: Log{ Format: "console", Level: slog.LevelInfo, }, Web: Web{ ListenAddress: ":4040", }, Syslog: Syslog{ ListenAddress: "udp://[::]:8514", }, }
View Source
var ErrEmptyConfigFile = errors.New("configuration file is empty")
View Source
var ErrRequired = errors.New("required")
View Source
var ErrVersion = errors.New("flag: version requested")
Functions ¶
Types ¶
type Config ¶
type Config struct {
Presets Presets `json:"presets" yaml:"presets"`
Nginx Nginx `json:"nginx" yaml:"nginx"`
Web Web `json:"web" yaml:"web"`
ConfigFile string `json:"config" yaml:"config"`
Syslog Syslog `json:"syslog" yaml:"syslog"`
Preset string `json:"preset" yaml:"preset"`
Log Log `json:"log" yaml:"log"`
WorkerCount int `json:"workerCount" yaml:"workerCount"`
BufferSize uint `json:"bufferSize" yaml:"bufferSize"`
Debug Debug `json:"debug" yaml:"debug"`
VerifyConfig bool `json:"-"`
}
func New ¶
New loads the configuration from configuration files, command line arguments and environment variables in that order.
func (*Config) ReadFromConfigFile ¶
ReadFromConfigFile reads the configuration from a configuration file and command line arguments.
func (*Config) ReadFromFlagAndEnvironment ¶
ReadFromFlagAndEnvironment reads the configuration from command line arguments and environment variables.
type Label ¶
type Label struct {
Name string `json:"name" yaml:"name"`
Replacements []Replacement `json:"replacements,omitempty" yaml:"replacements,omitempty"`
LineIndex uint `json:"lineIndex" yaml:"lineIndex"`
UserAgent bool `json:"userAgent" yaml:"userAgent"`
}
type Metric ¶
type Metric struct {
ConstLabels map[string]string `json:"constLabels" yaml:"constLabels"`
ValueIndex *uint `json:"valueIndex,omitempty" yaml:"valueIndex,omitempty"`
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
Help string `json:"help" yaml:"help"`
Buckets types.Float64Slice `json:"buckets,omitempty" yaml:"buckets,omitempty"`
Labels []Label `json:"labels" yaml:"labels"`
Replacements []Replacement `json:"replacements,omitempty" yaml:"replacements,omitempty"`
Upstream Upstream `json:"upstream" yaml:"upstream"`
Math Math `json:"math" yaml:"math"`
}
type Replacement ¶
type Replacement struct {
String *string `json:"string,omitempty" yaml:"string,omitempty"`
Regexp *regexp.Regexp `json:"regexp,omitempty" yaml:"regexp,omitempty"`
StringReplacer *strings.Replacer `json:"-" yaml:"-"`
Replacement string `json:"replacement" yaml:"replacement"`
}
func (*Replacement) UnmarshalYAML ¶ added in v0.3.0
func (r *Replacement) UnmarshalYAML(data *yaml.Node) error
type Syslog ¶
type Syslog struct {
ListenAddress string `json:"listenAddress" yaml:"listenAddress"`
}
Click to show internal directories.
Click to hide internal directories.