config

package
v0.0.0-...-dca2ff9 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChanSize          = 100
	NumberOfPipelines = 4
)

Pipeline constraints

View Source
const (
	TCPType          = "tcp"
	UDPType          = "udp"
	FileType         = "file"
	DockerType       = "docker"
	JournaldType     = "journald"
	WindowsEventType = "windows_event"
)

Logs source types

View Source
const (
	ExcludeAtMatch = "exclude_at_match"
	IncludeAtMatch = "include_at_match"
	MaskSequences  = "mask_sequences"
	MultiLine      = "multi_line"
)

Processing rule types

View Source
const ContainerCollectAll = "container_collect_all"

ContainerCollectAll is the name of the docker integration that collect logs from all containers

View Source
const (
	// DateFormat is the default date format.
	DateFormat = "2006-01-02T15:04:05.000000000Z"
)

Variables

This section is empty.

Functions

func CompileProcessingRules

func CompileProcessingRules(rules []*ProcessingRule) error

CompileProcessingRules compiles all processing rule regular expressions.

func TaggerWarmupDuration

func TaggerWarmupDuration() time.Duration

TaggerWarmupDuration is used to configure the tag providers

func ValidateProcessingRules

func ValidateProcessingRules(rules []*ProcessingRule) error

ValidateProcessingRules validates the rules and raises an error if one is misconfigured. Each processing rule must have: - a valid name - a valid type - a valid pattern that compiles

Types

type Endpoint

type Endpoint struct {
	APIKey           string `mapstructure:"api_key"`
	Host             string
	Port             int
	UseSSL           bool
	UseCompression   bool `mapstructure:"use_compression"`
	CompressionLevel int  `mapstructure:"compression_level"`
	ProxyAddress     string
}

Endpoint holds all the organization and network parameters to send logs to Datadog.

type Endpoints

type Endpoints struct {
	Main        Endpoint
	Additionals []Endpoint
	UseProto    bool
	UseHTTP     bool
	BatchWait   time.Duration
}

Endpoints holds the main endpoint and additional ones to dualship logs.

func BuildEndpoints

func BuildEndpoints() (*Endpoints, error)

BuildEndpoints returns the endpoints to send logs to.

func NewEndpoints

func NewEndpoints(main Endpoint, additionals []Endpoint, useProto bool, useHTTP bool, batchWait time.Duration) *Endpoints

NewEndpoints returns a new endpoints composite.

type LogSource

type LogSource struct {
	Name   string
	Config *LogsConfig
	Status *LogStatus

	Messages *Messages
	// contains filtered or unexported fields
}

LogSource holds a reference to an integration name and a log configuration, and allows to track errors and successful operations on it. Both name and configuration are static for now and determined at creation time. Changing the status is designed to be thread safe.

func DefaultSources

func DefaultSources() []*LogSource

DefaultSources returns the default log sources that can be directly set from the datadog.yaml or through environment variables.

func NewLogSource

func NewLogSource(name string, config *LogsConfig) *LogSource

NewLogSource creates a new log source.

func (*LogSource) AddInput

func (s *LogSource) AddInput(input string)

AddInput registers an input as being handled by this source.

func (*LogSource) GetInputs

func (s *LogSource) GetInputs() []string

GetInputs returns the inputs handled by this source.

func (*LogSource) GetSourceType

func (s *LogSource) GetSourceType() SourceType

GetSourceType returns the sourceType used by this source

func (*LogSource) RemoveInput

func (s *LogSource) RemoveInput(input string)

RemoveInput removes an input from this source.

func (*LogSource) SetSourceType

func (s *LogSource) SetSourceType(sourceType SourceType)

SetSourceType sets a format that give information on how the source lines should be parsed

type LogSources

type LogSources struct {
	// contains filtered or unexported fields
}

LogSources stores a list of log sources.

func CreateSources

func CreateSources(sourcesArray []*LogSource) *LogSources

CreateSources creates sources

func NewLogSources

func NewLogSources() *LogSources

NewLogSources creates a new log sources.

func (*LogSources) AddSource

func (s *LogSources) AddSource(source *LogSource)

AddSource adds a new source.

func (*LogSources) GetAddedForType

func (s *LogSources) GetAddedForType(sourceType string) chan *LogSource

GetAddedForType returns the new added sources matching the provided type.

func (*LogSources) GetRemovedForType

func (s *LogSources) GetRemovedForType(sourceType string) chan *LogSource

GetRemovedForType returns the new removed sources matching the provided type.

func (*LogSources) GetSources

func (s *LogSources) GetSources() []*LogSource

GetSources returns all the sources currently held.

func (*LogSources) RemoveSource

func (s *LogSources) RemoveSource(source *LogSource)

RemoveSource removes a source.

type LogStatus

type LogStatus struct {
	// contains filtered or unexported fields
}

LogStatus tracks errors and success.

func NewLogStatus

func NewLogStatus() *LogStatus

NewLogStatus creates a new log status.

func (*LogStatus) Error

func (s *LogStatus) Error(err error)

Error records the given error and invalidates the source.

func (*LogStatus) GetError

func (s *LogStatus) GetError() string

GetError returns the error.

func (*LogStatus) IsError

func (s *LogStatus) IsError() bool

IsError returns whether the current status is an error.

func (*LogStatus) IsPending

func (s *LogStatus) IsPending() bool

IsPending returns whether the current status is not yet determined.

func (*LogStatus) IsSuccess

func (s *LogStatus) IsSuccess() bool

IsSuccess returns whether the current status is a success.

func (*LogStatus) Success

func (s *LogStatus) Success()

Success sets the status to success.

type LogsConfig

type LogsConfig struct {
	Type string

	Port int    // Network
	Path string // File, Journald

	IncludeUnits  []string `mapstructure:"include_units" json:"include_units"`   // Journald
	ExcludeUnits  []string `mapstructure:"exclude_units" json:"exclude_units"`   // Journald
	ContainerMode bool     `mapstructure:"container_mode" json:"container_mode"` // Journald

	Image      string // Docker
	Label      string // Docker
	Name       string // Docker
	Identifier string // Docker

	ChannelPath string `mapstructure:"channel_path" json:"channel_path"` // Windows Event
	Query       string // Windows Event

	Service         string
	Source          string
	SourceCategory  string
	Tags            []string
	ProcessingRules []*ProcessingRule `mapstructure:"log_processing_rules" json:"log_processing_rules"`
}

LogsConfig represents a log source config, which can be for instance a file to tail or a port to listen to.

func ParseJSON

func ParseJSON(data []byte) ([]*LogsConfig, error)

ParseJSON parses the data formatted in JSON returns an error if the parsing failed.

func ParseYAML

func ParseYAML(data []byte) ([]*LogsConfig, error)

ParseYAML parses the data formatted in YAML, returns an error if the parsing failed.

func (*LogsConfig) Validate

func (c *LogsConfig) Validate() error

Validate returns an error if the config is misconfigured

type Messages

type Messages struct {
	// contains filtered or unexported fields
}

Messages holds messages and warning that can be displayed in the status Warnings are display at the top of the log section in the status and messages are displayed in the log source that generated the message

func NewMessages

func NewMessages() *Messages

NewMessages initialize Messages with the default values

func (*Messages) AddMessage

func (m *Messages) AddMessage(key string, message string)

AddMessage create a message

func (*Messages) GetMessages

func (m *Messages) GetMessages() []string

GetMessages returns all the messages

func (*Messages) RemoveMessage

func (m *Messages) RemoveMessage(key string)

RemoveMessage removes a message

type ProcessingRule

type ProcessingRule struct {
	Type               string
	Name               string
	ReplacePlaceholder string `mapstructure:"replace_placeholder" json:"replace_placeholder"`
	Pattern            string
	// TODO: should be moved out
	Regex       *regexp.Regexp
	Placeholder []byte
}

ProcessingRule defines an exclusion or a masking rule to be applied on log lines

func GlobalProcessingRules

func GlobalProcessingRules() ([]*ProcessingRule, error)

GlobalProcessingRules returns the global processing rules to apply to all logs.

type SourceType

type SourceType string

SourceType used for log line parsing logic. TODO: remove this logic.

const (
	// DockerSourceType docker source type
	DockerSourceType SourceType = "docker"
	// KubernetesSourceType kubernetes source type
	KubernetesSourceType SourceType = "kubernetes"
)

Jump to

Keyboard shortcuts

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