config

package
v0.71.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JSONFormat represents json format for log line
	JSONFormat Format = iota
	// KvPairFormat represents key-value format for log line
	KvPairFormat
	// DefaultKubernetesMetadataTagExpression for extracting the kubernetes metadata from tag
	DefaultKubernetesMetadataTagExpression = "\\.([^_]+)_([^_]+)_(.+)-([a-z0-9]{64})\\.log$"

	// DefaultKubernetesMetadataTagKey represents the key for the tag in the entry
	DefaultKubernetesMetadataTagKey = "tag"

	// DefaultKubernetesMetadataTagPrefix represents the prefix of the entry's tag
	DefaultKubernetesMetadataTagPrefix = "kubernetes\\.var\\.log\\.containers"

	// MaxJSONSize parsing size limits
	MaxJSONSize = 1 * 1024 * 1024 // 1MB limit for JSON parsing operations
	// MaxConfigSize config size limits
	MaxConfigSize = 512 * 1024 // 512KB limit for configuration JSON files
)

Variables

View Source
var DefaultBufferConfig = BufferConfig{
	Buffer:     false,
	BufferType: "dque",
	DqueConfig: DefaultDqueConfig,
}

DefaultBufferConfig holds the configurations for using output buffer

View Source
var DefaultDqueConfig = DqueConfig{
	QueueDir:         "/tmp/flb-storage/vali",
	QueueSegmentSize: 500,
	QueueSync:        false,
	QueueName:        "dque",
}

DefaultDqueConfig holds dque configurations for the buffer

View Source
var SeedControllerClientConfig = ControllerClientConfiguration{
	SendLogsWhenIsInCreationState:    true,
	SendLogsWhenIsInReadyState:       false,
	SendLogsWhenIsInHibernatingState: false,
	SendLogsWhenIsInHibernatedState:  false,
	SendLogsWhenIsInWakingState:      false,
	SendLogsWhenIsInDeletionState:    true,
	SendLogsWhenIsInDeletedState:     true,
	SendLogsWhenIsInRestoreState:     true,
	SendLogsWhenIsInMigrationState:   true,
}

SeedControllerClientConfig is the default controller client configuration

View Source
var ShootControllerClientConfig = ControllerClientConfiguration{
	SendLogsWhenIsInCreationState:    true,
	SendLogsWhenIsInReadyState:       true,
	SendLogsWhenIsInHibernatingState: false,
	SendLogsWhenIsInHibernatedState:  false,
	SendLogsWhenIsInWakingState:      true,
	SendLogsWhenIsInDeletionState:    true,
	SendLogsWhenIsInDeletedState:     true,
	SendLogsWhenIsInRestoreState:     true,
	SendLogsWhenIsInMigrationState:   true,
}

ShootControllerClientConfig is the main controller client configuration

Functions

This section is empty.

Types

type BufferConfig

type BufferConfig struct {
	Buffer     bool       `mapstructure:"Buffer"`
	BufferType string     `mapstructure:"BufferType"`
	DqueConfig DqueConfig `mapstructure:",squash"`
}

BufferConfig contains the buffer settings

type ClientConfig added in v0.35.0

type ClientConfig struct {
	// URL for the Vali instance
	URL flagext.URLValue `mapstructure:"-"`
	// ProxyURL for proxy configuration
	ProxyURL string `mapstructure:"ProxyURL"`
	// TenantID for multi-tenant setups
	TenantID string `mapstructure:"TenantID"`
	// BatchWait time before sending a batch
	BatchWait string `mapstructure:"BatchWait"`
	// BatchSize maximum size of a batch
	BatchSize int `mapstructure:"BatchSize"`
	// Labels to attach to logs
	Labels string `mapstructure:"-"`
	// MaxRetries for failed requests
	MaxRetries int `mapstructure:"MaxRetries"`
	// Timeout for requests
	Timeout string `mapstructure:"Timeout"`
	// MinBackoff time for retries
	MinBackoff string `mapstructure:"MinBackoff"`
	// MaxBackoff time for retries
	MaxBackoff string `mapstructure:"MaxBackoff"`

	// CredativValiConfig holds the configuration for the credativ/vali client
	CredativValiConfig client.Config `mapstructure:"-"`
	// BufferConfig holds the configuration for the buffered client
	BufferConfig BufferConfig `mapstructure:",squash"`
	// SortByTimestamp indicates whether the logs should be sorted ot not
	SortByTimestamp bool `mapstructure:"SortByTimestamp"`
	// NumberOfBatchIDs is number of id per batch.
	// This increase the number of vali label streams
	NumberOfBatchIDs uint64 `mapstructure:"NumberOfBatchIDs"`
	// IDLabelName is the name of the batch id label key.
	IDLabelName model.LabelName `mapstructure:"IdLabelName"`
	// TestingClient is mocked credativ/vali client used for testing purposes
	TestingClient client.Client `mapstructure:"-"`
}

ClientConfig holds configuration for the chain of clients.

type Config

type Config struct {
	ClientConfig     ClientConfig     `mapstructure:",squash"`
	ControllerConfig ControllerConfig `mapstructure:",squash"`
	PluginConfig     PluginConfig     `mapstructure:",squash"`
	LogLevel         logging.Level    `mapstructure:"LogLevel"`
	Pprof            bool             `mapstructure:"Pprof"`
}

Config holds the needed properties of the vali output plugin

func ParseConfig

func ParseConfig(configMap map[string]any) (*Config, error)

ParseConfig parses a configuration from a map of string interfaces

func ParseConfigFromStringMap added in v0.66.0

func ParseConfigFromStringMap(configMap map[string]string) (*Config, error)

ParseConfigFromStringMap parses a configuration from a string-to-string map

type ControllerClientConfiguration added in v0.37.0

type ControllerClientConfiguration struct {
	SendLogsWhenIsInCreationState    bool
	SendLogsWhenIsInReadyState       bool
	SendLogsWhenIsInHibernatingState bool
	SendLogsWhenIsInHibernatedState  bool
	SendLogsWhenIsInWakingState      bool
	SendLogsWhenIsInDeletionState    bool
	SendLogsWhenIsInDeletedState     bool
	SendLogsWhenIsInRestoreState     bool
	SendLogsWhenIsInMigrationState   bool
}

ControllerClientConfiguration contains flags which mutes/unmutes Shoot's and Seed Vali for a given Shoot state.

type ControllerConfig added in v0.35.0

type ControllerConfig struct {
	// CtlSyncTimeout for resource synchronization
	CtlSyncTimeout time.Duration `mapstructure:"ControllerSyncTimeout"`
	// DynamicHostPrefix is the prefix of the dynamic host endpoint
	DynamicHostPrefix string `mapstructure:"DynamicHostPrefix"`
	// DynamicHostSuffix is the suffix of the dynamic host endpoint
	DynamicHostSuffix string `mapstructure:"DynamicHostSuffix"`
	// DeletedClientTimeExpiration is the time after a client for
	// deleted shoot should be cosidered for removal
	DeletedClientTimeExpiration time.Duration `mapstructure:"DeletedClientTimeExpiration"`
	// ShootControllerClientConfig configure to whether to send or not the log to the shoot
	// Vali for a particular shoot state.
	ShootControllerClientConfig ControllerClientConfiguration `mapstructure:"-"`
	// SeedControllerClientConfig configure to whether to send or not the log to the shoot
	// Vali for a particular shoot state.
	SeedControllerClientConfig ControllerClientConfiguration `mapstructure:"-"`
}

ControllerConfig hold the configuration fot the Vali client controller

type DqueConfig

type DqueConfig struct {
	QueueDir         string `mapstructure:"QueueDir"`
	QueueSegmentSize int    `mapstructure:"QueueSegmentSize"`
	QueueSync        bool   `mapstructure:"-"` // Handled specially in postProcessConfig
	QueueName        string `mapstructure:"QueueName"`
}

DqueConfig contains the dqueue settings

type Format

type Format int

Format is the log line format

type KubernetesMetadataExtraction

type KubernetesMetadataExtraction struct {
	FallbackToTagWhenMetadataIsMissing bool   `mapstructure:"FallbackToTagWhenMetadataIsMissing"`
	DropLogEntryWithoutK8sMetadata     bool   `mapstructure:"DropLogEntryWithoutK8sMetadata"`
	TagKey                             string `mapstructure:"TagKey"`
	TagPrefix                          string `mapstructure:"TagPrefix"`
	TagExpression                      string `mapstructure:"TagExpression"`
}

KubernetesMetadataExtraction holds kubernetes metadata extraction configuration

type PluginConfig added in v0.35.0

type PluginConfig struct {
	// AutoKubernetesLabels enables automatic kubernetes labels extraction
	AutoKubernetesLabels bool `mapstructure:"AutoKubernetesLabels"`
	// LineFormat specifies the log line format
	LineFormat Format `mapstructure:"-"`
	// DropSingleKey drops single keys from log entries
	DropSingleKey bool `mapstructure:"DropSingleKey"`
	// LabelKeys specifies which keys to use as labels
	LabelKeys []string `mapstructure:"-"`
	// RemoveKeys specifies which keys to remove from log entries
	RemoveKeys []string `mapstructure:"-"`
	// LabelMap provides a map for label transformations
	LabelMap map[string]any `mapstructure:"-"`
	// DynamicHostPath provides dynamic host path configuration
	DynamicHostPath map[string]any `mapstructure:"-"`
	// DynamicHostRegex specifies regex for dynamic host matching
	DynamicHostRegex string `mapstructure:"DynamicHostRegex"`
	// KubernetesMetadata holds kubernetes metadata extraction configuration
	KubernetesMetadata KubernetesMetadataExtraction `mapstructure:",squash"`
	// LabelSetInitCapacity sets the initial capacity for label sets
	LabelSetInitCapacity int `mapstructure:"LabelSetInitCapacity"`
	// HostnameKey specifies the hostname key
	HostnameKey string `mapstructure:"HostnameKey"`
	// HostnameValue specifies the hostname value
	HostnameValue string `mapstructure:"HostnameValue"`
	// HostnameKeyValue specifies the hostname key value pair,
	// it has higher priority than HostnameKey and HostnameValue
	HostnameKeyValue *string `mapstructure:"-"`
	// PreservedLabels specifies labels to preserve
	PreservedLabels model.LabelSet `mapstructure:"-"`
	// EnableMultiTenancy enables multi-tenancy support
	EnableMultiTenancy bool `mapstructure:"EnableMultiTenancy"`
}

PluginConfig holds configuration for the plugin

Jump to

Keyboard shortcuts

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