conf

package
v0.0.0-...-fbb851a Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPath is default path for storing logs
	DefaultPath = "/opt/openGemini/logs/"

	// DefaultLevel is the level of logs will be emitted
	DefaultLevel = zap.InfoLevel

	// DefaultMaxSize is the max size of a log file
	DefaultMaxSize = 64 * 1024 * 1024 // 64MB

	// DefaultMaxNum is the max number of log files
	DefaultMaxNum = 16

	// DefaultMaxAge is the max duration a log file can keep
	DefaultMaxAge = 7 // 7days

	// DefaultCompressEnabled is whether the log files are compressed
	DefaultCompressEnabled = true
)

Variables

This section is empty.

Functions

func Parse

func Parse(conf *Config, path string) error

func ParsePlugins

func ParsePlugins(t *ast.Table, ty PluginType, c *Config, creator map[string]node.Creator) error

Types

type App

type App string

type Config

type Config struct {
	Logging *Logger           `toml:"logging"`
	TLS     *tlsconfig.Config `toml:"tls"`
	Http    *Http             `toml:"http"`

	Inputs  []node.Node
	Outputs []node.Node
	Parsers []node.Node
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() *Config

func (*Config) GetLogConfig

func (c *Config) GetLogConfig() Logger

func (*Config) Validate

func (c *Config) Validate() error

type Http

type Http struct {
	BindAddress string `toml:"bind-address"`

	PprofEnabled bool `toml:"pprof-enabled"`
}

func NewHttpConfig

func NewHttpConfig() *Http

type Logger

type Logger struct {
	Format          string        `toml:"format"`
	Level           zapcore.Level `toml:"level"`
	MaxSize         toml.Size     `toml:"max-size"`
	MaxNum          int           `toml:"max-num"`
	MaxAge          int           `toml:"max-age"`
	CompressEnabled bool          `toml:"compress-enabled"`
	Path            string        `toml:"path"`
	// contains filtered or unexported fields
}

func GetStoreLogger

func GetStoreLogger() *Logger

func NewLogger

func NewLogger(app App) *Logger

NewLogger returns a new instance of Config with defaults.

func (*Logger) Build

func (c *Logger) Build(name string) *lumberjack.Logger

func (*Logger) GetFileName

func (c *Logger) GetFileName() string

func (*Logger) SetApp

func (c *Logger) SetApp(app App)

func (Logger) Validate

func (c Logger) Validate() error

Validate validates that the configuration is acceptable.

type PluginType

type PluginType int
const (
	INPUT PluginType = iota
	PARSER
	OUTPUT
)

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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