Documentation ¶
Index ¶
- Constants
- func AggregationTimeout() time.Duration
- func CompileProcessingRules(rules []*ProcessingRule) error
- func ContainsWildcard(path string) bool
- func ExpectedTagsDuration() time.Duration
- func HasMultiLineRule(rules []*ProcessingRule) bool
- func IsExpectedTagsSet() bool
- func TaggerWarmupDuration() time.Duration
- func ValidateProcessingRules(rules []*ProcessingRule) error
- type ChannelMessage
- type EPIntakeVersion
- type Endpoint
- type Endpoints
- func BuildEndpoints(httpConnectivity HTTPConnectivity, intakeTrackType IntakeTrackType, ...) (*Endpoints, error)
- func BuildEndpointsWithConfig(logsConfig *LogsConfigKeys, endpointPrefix string, ...) (*Endpoints, error)
- func BuildEndpointsWithVectorOverride(httpConnectivity HTTPConnectivity, intakeTrackType IntakeTrackType, ...) (*Endpoints, error)
- func BuildHTTPEndpoints(intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, ...) (*Endpoints, error)
- func BuildHTTPEndpointsWithConfig(logsConfig *LogsConfigKeys, endpointPrefix string, ...) (*Endpoints, error)
- func BuildHTTPEndpointsWithVectorOverride(intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, ...) (*Endpoints, error)
- func BuildServerlessEndpoints(intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol) (*Endpoints, error)
- func NewEndpoints(main Endpoint, additionalEndpoints []Endpoint, useProto bool, useHTTP bool) *Endpoints
- func NewEndpointsWithBatchSettings(main Endpoint, additionalEndpoints []Endpoint, useProto bool, useHTTP bool, ...) *Endpoints
- type HTTPConnectivity
- type IntakeOrigin
- type IntakeProtocol
- type IntakeTrackType
- type Lambda
- type LogsConfig
- type LogsConfigKeys
- type Messages
- type ProcessingRule
- type TailingMode
Constants ¶
const ( ChanSize = 100 DestinationPayloadChanSize = 10 NumberOfPipelines = 4 )
Pipeline constraints
const ( TCPType = "tcp" UDPType = "udp" FileType = "file" DockerType = "docker" ContainerdType = "containerd" JournaldType = "journald" WindowsEventType = "windows_event" StringChannelType = "string_channel" // UTF16BE for UTF-16 Big endian encoding UTF16BE string = "utf-16-be" // UTF16LE for UTF-16 Little Endian encoding UTF16LE string = "utf-16-le" // SHIFTJIS for Shift JIS (Japanese) encoding SHIFTJIS string = "shift-jis" )
Logs source types
const ( ForceBeginning = iota ForceEnd Beginning End )
Tailing Modes
const ( ExcludeAtMatch = "exclude_at_match" IncludeAtMatch = "include_at_match" MaskSequences = "mask_sequences" MultiLine = "multi_line" )
Processing rule types
const ContainerCollectAll = "container_collect_all"
ContainerCollectAll is the name of the docker integration that collect logs from all containers
const (
// DateFormat is the default date format.
DateFormat = "2006-01-02T15:04:05.000000000Z"
)
Variables ¶
This section is empty.
Functions ¶
func AggregationTimeout ¶ added in v0.9.0
AggregationTimeout is used when performing aggregation operations
func CompileProcessingRules ¶
func CompileProcessingRules(rules []*ProcessingRule) error
CompileProcessingRules compiles all processing rule regular expressions.
func ContainsWildcard ¶
ContainsWildcard returns true if the path contains any wildcard character
func ExpectedTagsDuration ¶ added in v0.9.0
ExpectedTagsDuration returns a duration of the time expected tags will be submitted for.
func HasMultiLineRule ¶
func HasMultiLineRule(rules []*ProcessingRule) bool
HasMultiLineRule returns true if the rule set contains a multi_line rule
func IsExpectedTagsSet ¶ added in v0.9.0
func IsExpectedTagsSet() bool
IsExpectedTagsSet returns boolean showing if expected tags feature is enabled.
func TaggerWarmupDuration ¶
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 ChannelMessage ¶ added in v0.9.0
type ChannelMessage struct { Content []byte // Optional. Must be UTC. If not provided, time.Now().UTC() will be used // Used in the Serverless Agent Timestamp time.Time // Optional. // Used in the Serverless Agent Lambda *Lambda IsError bool }
ChannelMessage represents a log line sent to datadog, with its metadata
func NewChannelMessageFromLambda ¶ added in v0.9.0
func NewChannelMessageFromLambda(content []byte, utcTime time.Time, ARN, reqID string) *ChannelMessage
NewChannelMessageFromLambda construts a message with content and with the given timestamp and Lambda metadata
type EPIntakeVersion ¶ added in v0.9.0
type EPIntakeVersion uint8
EPIntakeVersion is the events platform intake API version
const ( // EPIntakeVersion1 is version 1 of the envets platform intake API EPIntakeVersion1 EPIntakeVersion // EPIntakeVersion2 is version 2 of the envets platform intake API EPIntakeVersion2 )
type Endpoint ¶
type Endpoint struct { APIKey string `mapstructure:"api_key" json:"api_key"` Host string Port int UseSSL bool UseCompression bool `mapstructure:"use_compression" json:"use_compression"` CompressionLevel int `mapstructure:"compression_level" json:"compression_level"` ProxyAddress string IsReliable *bool `mapstructure:"is_reliable" json:"is_reliable"` ConnectionResetInterval time.Duration BackoffFactor float64 BackoffBase float64 BackoffMax float64 RecoveryInterval int RecoveryReset bool Version EPIntakeVersion TrackType IntakeTrackType Protocol IntakeProtocol Origin IntakeOrigin }
Endpoint holds all the organization and network parameters to send logs to Datadog.
func (*Endpoint) GetIsReliable ¶
GetIsReliable returns true if the endpoint is reliable. Endpoints are reliable by default.
type Endpoints ¶
type Endpoints struct { Main Endpoint Endpoints []Endpoint UseProto bool UseHTTP bool BatchWait time.Duration BatchMaxConcurrentSend int BatchMaxSize int BatchMaxContentSize int InputChanSize int }
Endpoints holds the main endpoint and additional ones to dualship logs.
func BuildEndpoints ¶
func BuildEndpoints(httpConnectivity HTTPConnectivity, intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, intakeOrigin IntakeOrigin) (*Endpoints, error)
BuildEndpoints returns the endpoints to send logs.
func BuildEndpointsWithConfig ¶ added in v0.9.0
func BuildEndpointsWithConfig(logsConfig *LogsConfigKeys, endpointPrefix string, httpConnectivity HTTPConnectivity, intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, intakeOrigin IntakeOrigin) (*Endpoints, error)
BuildEndpointsWithConfig returns the endpoints to send logs.
func BuildEndpointsWithVectorOverride ¶
func BuildEndpointsWithVectorOverride(httpConnectivity HTTPConnectivity, intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, intakeOrigin IntakeOrigin) (*Endpoints, error)
BuildEndpointsWithVectorOverride returns the endpoints to send logs and enforce Vector override config keys
func BuildHTTPEndpoints ¶
func BuildHTTPEndpoints(intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, intakeOrigin IntakeOrigin) (*Endpoints, error)
BuildHTTPEndpoints returns the HTTP endpoints to send logs to.
func BuildHTTPEndpointsWithConfig ¶ added in v0.9.0
func BuildHTTPEndpointsWithConfig(logsConfig *LogsConfigKeys, endpointPrefix string, intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, intakeOrigin IntakeOrigin) (*Endpoints, error)
BuildHTTPEndpointsWithConfig uses two arguments that instructs it how to access configuration parameters, then returns the HTTP endpoints to send logs to. This function is able to default to the 'classic' BuildHTTPEndpoints() w ldHTTPEndpointsWithConfigdefault variables logsConfigDefaultKeys and httpEndpointPrefix
func BuildHTTPEndpointsWithVectorOverride ¶
func BuildHTTPEndpointsWithVectorOverride(intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol, intakeOrigin IntakeOrigin) (*Endpoints, error)
BuildHTTPEndpointsWithVectorOverride returns the HTTP endpoints to send logs to.
func BuildServerlessEndpoints ¶ added in v0.9.0
func BuildServerlessEndpoints(intakeTrackType IntakeTrackType, intakeProtocol IntakeProtocol) (*Endpoints, error)
BuildServerlessEndpoints returns the endpoints to send logs for the Serverless agent.
func NewEndpoints ¶
func NewEndpoints(main Endpoint, additionalEndpoints []Endpoint, useProto bool, useHTTP bool) *Endpoints
NewEndpoints returns a new endpoints composite with default batching settings
func NewEndpointsWithBatchSettings ¶ added in v0.9.0
func NewEndpointsWithBatchSettings(main Endpoint, additionalEndpoints []Endpoint, useProto bool, useHTTP bool, batchWait time.Duration, batchMaxConcurrentSend int, batchMaxSize int, batchMaxContentSize int, inputChanSize int) *Endpoints
NewEndpointsWithBatchSettings returns a new endpoints composite with non-default batching settings specified
func (*Endpoints) GetReliableEndpoints ¶
GetReliableEndpoints returns additional endpoints that can be failed over to and block the pipeline in the event of an outage and will retry errors. These endpoints are treated the same as the main endpoint.
func (*Endpoints) GetUnReliableEndpoints ¶
GetUnReliableEndpoints returns additional endpoints that do not guarantee logs are received in the event of an error.
type HTTPConnectivity ¶
type HTTPConnectivity bool
HTTPConnectivity is the status of the HTTP connectivity
var ( // HTTPConnectivitySuccess is the status for successful HTTP connectivity HTTPConnectivitySuccess HTTPConnectivity = true // HTTPConnectivityFailure is the status for failed HTTP connectivity HTTPConnectivityFailure HTTPConnectivity = false )
type IntakeOrigin ¶ added in v0.9.0
type IntakeOrigin string
IntakeOrigin indicates the log source to use for an endpoint intake.
const DefaultIntakeOrigin IntakeOrigin = "agent"
DefaultIntakeOrigin indicates that no special DD_SOURCE header is in use for the endpoint intake track type.
const ServerlessIntakeOrigin IntakeOrigin = "lambda-extension"
ServerlessIntakeOrigin is the lambda extension origin
type IntakeProtocol ¶ added in v0.9.0
type IntakeProtocol string
IntakeProtocol indicates the protocol to use for an endpoint intake.
const DefaultIntakeProtocol IntakeProtocol = ""
DefaultIntakeProtocol indicates that no special protocol is in use for the endpoint intake track type.
type IntakeTrackType ¶ added in v0.9.0
type IntakeTrackType string
IntakeTrackType indicates the type of an endpoint intake.
type Lambda ¶ added in v0.9.0
Lambda is a struct storing information about the Lambda function and function execution.
type LogsConfig ¶
type LogsConfig struct { Type string Port int // Network IdleTimeout string `mapstructure:"idle_timeout" json:"idle_timeout"` // Network Path string // File, Journald Encoding string `mapstructure:"encoding" json:"encoding"` // File ExcludePaths []string `mapstructure:"exclude_paths" json:"exclude_paths"` // File TailingMode string `mapstructure:"start_position" json:"start_position"` // File ConfigId string `mapstructure:"config_id" json:"config_id"` // Journald IncludeSystemUnits []string `mapstructure:"include_units" json:"include_units"` // Journald ExcludeSystemUnits []string `mapstructure:"exclude_units" json:"exclude_units"` // Journald IncludeUserUnits []string `mapstructure:"include_user_units" json:"include_user_units"` // Journald ExcludeUserUnits []string `mapstructure:"exclude_user_units" json:"exclude_user_units"` // Journald IncludeMatches []string `mapstructure:"include_matches" json:"include_matches"` // Journald ExcludeMatches []string `mapstructure:"exclude_matches" json:"exclude_matches"` // Journald ContainerMode bool `mapstructure:"container_mode" json:"container_mode"` // Journald Image string // Docker Label string // Docker // Name contains the container name Name string // Docker // Identifier contains the container ID. This is also set for File sources and used to // determine the appropriate tags for the logs. Identifier string // Docker, File ChannelPath string `mapstructure:"channel_path" json:"channel_path"` // Windows Event Query string // Windows Event // used as input only by the Channel tailer. // could have been unidirectional but the tailer could not close it in this case. Channel chan *ChannelMessage // ChannelTags are the tags attached to messages on Channel; unlike Tags this can be // modified at runtime (as long as ChannelTagsMutex is held). ChannelTags []string // ChannelTagsMutex guards ChannelTags. ChannelTagsMutex sync.Mutex Service string Source string SourceCategory string Tags []string ProcessingRules []*ProcessingRule `mapstructure:"log_processing_rules" json:"log_processing_rules"` AutoMultiLine *bool `mapstructure:"auto_multi_line_detection" json:"auto_multi_line_detection"` AutoMultiLineSampleSize int `mapstructure:"auto_multi_line_sample_size" json:"auto_multi_line_sample_size"` AutoMultiLineMatchThreshold float64 `mapstructure:"auto_multi_line_match_threshold" json:"auto_multi_line_match_threshold"` }
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) AutoMultiLineEnabled ¶
func (c *LogsConfig) AutoMultiLineEnabled() bool
AutoMultiLineEnabled determines whether auto multi line detection is enabled for this config, considering both the agent-wide logs_config.auto_multi_line_detection and any config for this particular log source.
func (*LogsConfig) Dump ¶
func (c *LogsConfig) Dump(multiline bool) string
Dump dumps the contents of this struct to a string, for debugging purposes.
func (*LogsConfig) Validate ¶
func (c *LogsConfig) Validate() error
Validate returns an error if the config is misconfigured
type LogsConfigKeys ¶ added in v0.9.0
type LogsConfigKeys struct {
// contains filtered or unexported fields
}
LogsConfigKeys stores logs configuration keys stored in YAML configuration files
func NewLogsConfigKeys ¶ added in v0.9.0
func NewLogsConfigKeys(configPrefix string, config coreConfig.Config) *LogsConfigKeys
NewLogsConfigKeys returns a new logs configuration keys set
func NewLogsConfigKeysWithVector ¶
func NewLogsConfigKeysWithVector(configPrefix, vectorPrefix string, config coreConfig.Config) *LogsConfigKeys
NewLogsConfigKeysWithVector returns a new logs configuration keys set with vector config keys enabled
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 ¶
AddMessage create a message
func (*Messages) GetMessages ¶
GetMessages returns all the messages
func (*Messages) RemoveMessage ¶
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 TailingMode ¶
type TailingMode uint8
TailingMode type
func TailingModeFromString ¶
func TailingModeFromString(mode string) (TailingMode, bool)
TailingModeFromString parses a string and returns a corresponding tailing mode, default to End if not found
func (TailingMode) String ¶
func (mode TailingMode) String() string
TailingModeToString returns seelog string representation for a specified tailing mode. Returns "" for invalid tailing mode.