config

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 15 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"
)

Variables

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

DefaultBufferConfig holds the configurations for using output buffer

View Source
var DefaultClientCfg = client.Config{}

DefaultClientCfg is the default gardener vali plugin client configuration.

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
	BufferType string
	DqueConfig DqueConfig
}

BufferConfig contains the buffer settings

type ClientConfig added in v0.35.0

type ClientConfig struct {
	// CredativValiConfig holds the configuration for the credativ/vali client
	CredativValiConfig client.Config
	// BufferConfig holds the configuration for the buffered client
	BufferConfig BufferConfig
	// SortByTimestamp indicates whether the logs should be sorted ot not
	SortByTimestamp bool
	// NumberOfBatchIDs is number of id per batch.
	// This increase the number of vali label streams
	NumberOfBatchIDs uint64
	// IdLabelName is the name of the batch id label key.
	IdLabelName model.LabelName
	// TestingClient is mocked credativ/vali client used for testing purposes
	TestingClient client.Client
}

ClientConfig holds configuration for the clients

type Config

type Config struct {
	ClientConfig     ClientConfig
	ControllerConfig ControllerConfig
	PluginConfig     PluginConfig
	LogLevel         logging.Level
	Pprof            bool
}

Config holds the needed properties of the vali output plugin

func ParseConfig

func ParseConfig(cfg Getter) (*Config, error)

ParseConfig parse a Vali plugin configuration

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
	// DynamicHostPrefix is the prefix of the dynamic host endpoint
	DynamicHostPrefix string
	// DynamicHostSuffix is the suffix of the dynamic host endpoint
	DynamicHostSuffix string
	// DeletedClientTimeExpiration is the time after a client for
	// deleted shoot should be cosidered for removal
	DeletedClientTimeExpiration time.Duration
	// ShootControllerClientConfig configure to whether to send or not the log to the shoot
	// Vali for a particular shoot state.
	ShootControllerClientConfig ControllerClientConfiguration
	// SeedControllerClientConfig configure to whether to send or not the log to the shoot
	// Vali for a particular shoot state.
	SeedControllerClientConfig ControllerClientConfiguration
}

ControllerConfig hold the configuration fot the Vali client controller

type DqueConfig

type DqueConfig struct {
	QueueDir         string
	QueueSegmentSize int
	QueueSync        bool
	QueueName        string
}

DqueConfig contains the dqueue settings

type DynamicTenant added in v0.36.0

type DynamicTenant struct {
	Tenant                                string
	Field                                 string
	Regex                                 string
	RemoveTenantIdWhenSendingToDefaultURL bool
}

DynamicTenant contains specs for the valiplugin dynamic functionality

type Format

type Format int

Format is the log line format

type Getter

type Getter interface {
	Get(key string) string
}

Getter get a configuration settings base on the passed key.

type KubernetesMetadataExtraction

type KubernetesMetadataExtraction struct {
	FallbackToTagWhenMetadataIsMissing bool
	DropLogEntryWithoutK8sMetadata     bool
	TagKey                             string
	TagPrefix                          string
	TagExpression                      string
}

KubernetesMetadataExtraction holds the configurations for retrieving the meta data from a tag

type PluginConfig added in v0.35.0

type PluginConfig struct {
	// AutoKubernetesLabels extact all key/values from the kubernetes field.
	AutoKubernetesLabels bool
	// RemoveKeys specify removing keys.
	RemoveKeys []string
	// LabelKeys is comma separated list of keys to use as stream labels.
	LabelKeys []string
	// LineFormat is the format to use when flattening the record to a log line.
	LineFormat Format
	// DropSingleKey if set to true and after extracting label_keys a record only
	// has a single key remaining, the log line sent to Vali will just be
	// the value of the record key.
	DropSingleKey bool
	// LabelMap is path to a json file defining how to transform nested records.
	LabelMap map[string]interface{}
	// DynamicHostPath is jsonpath in the log labels to the dynamic host.
	DynamicHostPath map[string]interface{}
	// DynamicHostRegex is regex to check if the dynamic host is valid.
	DynamicHostRegex string
	// KubernetesMetadata holds the configurations for retrieving the meta data from a tag.
	KubernetesMetadata KubernetesMetadataExtraction
	//DynamicTenant holds the configurations for retrieving the tenant from a record key.
	DynamicTenant DynamicTenant
	//LabelSetInitCapacity the initial capacity of the labelset stream.
	LabelSetInitCapacity int
	//HostnameKey is the key name of the hostname key/value pair.
	HostnameKey *string
	//HostnameValue is the value name of the hostname key/value pair.
	HostnameValue *string
	//PreservedLabels is the set of label which will be preserved after packing the handled logs.
	PreservedLabels model.LabelSet
	//EnableMultiTenancy switch on and off the parsing of __gardener_multitenancy_id__ label
	EnableMultiTenancy bool
}

PluginConfig contains the configuration mostly related to the Vali plugin.

Jump to

Keyboard shortcuts

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