config

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 13 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{}
View Source
var DefaultControllerClientConfig = ControllerClientConfiguration{
	SendLogsWhenIsInCreationState:    true,
	SendLogsWhenIsInReadyState:       false,
	SendLogsWhenIsInHibernatingState: false,
	SendLogsWhenIsInHibernatedState:  false,
	SendLogsWhenIsInWakingState:      false,
	SendLogsWhenIsInDeletionState:    true,
	SendLogsWhenIsInDeletedState:     true,
	SendLogsWhenIsInRestoreState:     true,
	SendLogsWhenIsInMigrationState:   true,
}
View Source
var DefaultDqueConfig = DqueConfig{
	QueueDir:         "/tmp/flb-storage/loki",
	QueueSegmentSize: 500,
	QueueSync:        false,
	QueueName:        "dque",
}

DefaultDqueConfig holds dque configurations for the buffer

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

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 {
	// GrafanaLokiConfig holds the configuration for the grafana/loki client
	GrafanaLokiConfig 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 loki label streams
	NumberOfBatchIDs uint64
	// IdLabelName is the name of the batch id label key.
	IdLabelName model.LabelName
	// TestingClient is mocked grafana/loki 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 all of the needet properties of the loki output plugin

func ParseConfig

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

ParseConfig parse a Loki 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 Loki 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
	// MainControllerClientConfig configure to whether to send or not the log to the shoot
	// Loki for a particular shoot state.
	MainControllerClientConfig ControllerClientConfiguration
	// DefaultControllerClientConfig configure to whether to send or not the log to the shoot
	// Loki for a particular shoot state.
	DefaultControllerClientConfig ControllerClientConfiguration
}

ControllerConfig hold the configuration fot the Loki 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
}

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 Loki 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
}

PluginConfig contains the configuration mostly related to the Loki plugin.

Jump to

Keyboard shortcuts

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