Documentation
¶
Overview ¶
Package setup defines the configuration of the agent
Index ¶
- Constants
- Variables
- func Datadog() pkgconfigmodel.Config
- func FleetConfigOverride(_ pkgconfigmodel.Config)
- func GetDefaultSecurityProfilesDir() string
- func GetIPCAddress(config pkgconfigmodel.Reader) (string, error)
- func GetIPCPort() string
- func GetProcessAPIAddressPort(config pkgconfigmodel.Reader) (string, error)
- func GetSecurityAgentAPIAddressPort(config pkgconfigmodel.Reader) (string, error)
- func GlobalConfigBuilder() pkgconfigmodel.BuildableConfig
- func GlobalSystemProbeConfigBuilder() pkgconfigmodel.BuildableConfig
- func InitConfig(config pkgconfigmodel.Setup)
- func InitSystemProbeConfig(cfg pkgconfigmodel.Setup)
- func IsCLCRunner(config pkgconfigmodel.Reader) bool
- func LoadDatadog(config pkgconfigmodel.Config, secretResolver secrets.Component, ...) error
- func LoadProxyFromEnv(config pkgconfigmodel.ReaderWriter)
- func LoadSystemProbe(config pkgconfigmodel.Config, additionalKnownEnvVars []string) error
- func Merge(configPaths []string, config pkgconfigmodel.Config) error
- func OTLP(config pkgconfigmodel.Setup)
- func SetDatadog(cfg pkgconfigmodel.BuildableConfig)
- func SetSystemProbe(cfg pkgconfigmodel.BuildableConfig)
- func SystemProbe() pkgconfigmodel.Config
- type ChangeChecker
- type ConfigurationProviders
- type Listeners
- type UnexpectedUnicodeCodepoint
Constants ¶
const ( // DefaultFingerprintingMaxBytes is the maximum number of bytes that will be used to generate a checksum fingerprint; // used in cases where the line to hash is too large or if the fingerprinting maxLines=0 DefaultFingerprintingMaxBytes = 100000 // DefaultLinesOrBytesToSkip is the default number of lines (or bytes) to skip when reading a file. // Whether we skip lines or bytes is dependent on whether we choose to compute the fingerprint by lines or by bytes. DefaultLinesOrBytesToSkip = 0 // DefaultFingerprintingMaxLines is the default maximum number of lines to read before computing the fingerprint. DefaultFingerprintingMaxLines = 1 // DefaultFingerprintStrategy is the default strategy for computing the checksum fingerprint. // Options are: // - "line_checksum": compute the fingerprint by lines // - "byte_checksum": compute the fingerprint by bytes // - "disabled": disable fingerprinting DefaultFingerprintStrategy = "disabled" // DefaultSite is the default site the Agent sends data to. DefaultSite = "datadoghq.com" // DefaultNumWorkers default number of workers for our check runner DefaultNumWorkers = 4 // MaxNumWorkers maximum number of workers for our check runner MaxNumWorkers = 25 // DefaultAPIKeyValidationInterval is the default interval of api key validation checks DefaultAPIKeyValidationInterval = 60 // DefaultForwarderRecoveryInterval is the default recovery interval, // also used if the user-provided value is invalid. DefaultForwarderRecoveryInterval = 2 // DefaultBatchWait is the default HTTP batch wait in second for logs DefaultBatchWait = 5 // DefaultBatchMaxConcurrentSend is the default HTTP batch max concurrent send for logs DefaultBatchMaxConcurrentSend = 0 // DefaultBatchMaxSize is the default HTTP batch max size (maximum number of events in a single batch) for logs DefaultBatchMaxSize = 1000 // DefaultInputChanSize is the default input chan size for events DefaultInputChanSize = 100 // DefaultBatchMaxContentSize is the default HTTP batch max content size (before compression) for logs // It is also the maximum possible size of a single event. Events exceeding this limit are dropped. DefaultBatchMaxContentSize = 5000000 // DefaultAuditorTTL is the default logs auditor TTL in hours DefaultAuditorTTL = 23 // DefaultRuntimePoliciesDir is the default policies directory used by the runtime security module DefaultRuntimePoliciesDir = "/etc/datadog-agent/runtime-security.d" // DefaultCompressorKind is the default compressor. Options available are 'zlib' and 'zstd' DefaultCompressorKind = "zstd" // DefaultLogCompressionKind is the default log compressor. Options available are 'zstd' and 'gzip' DefaultLogCompressionKind = "zstd" // DefaultZstdCompressionLevel is the default compression level for `zstd`. // Compression level 1 provides the lowest compression ratio, but uses much less RSS especially // in situations where we have a high value for `GOMAXPROCS`. DefaultZstdCompressionLevel = 1 // DefaultGzipCompressionLevel is the default gzip compression level for logs. DefaultGzipCompressionLevel = 6 // DefaultLogsSenderBackoffFactor is the default logs sender backoff randomness factor DefaultLogsSenderBackoffFactor = 2.0 // DefaultLogsSenderBackoffBase is the default logs sender base backoff time, seconds DefaultLogsSenderBackoffBase = 1.0 // DefaultLogsSenderBackoffMax is the default logs sender maximum backoff time, seconds DefaultLogsSenderBackoffMax = 120.0 // DefaultLogsSenderBackoffRecoveryInterval is the default logs sender backoff recovery interval DefaultLogsSenderBackoffRecoveryInterval = 2 // DefaultLocalProcessCollectorInterval is the interval at which processes are collected and sent to the workloadmeta // in the core agent if the process check is disabled. DefaultLocalProcessCollectorInterval = 1 * time.Minute // DefaultMaxMessageSizeBytes is the default value for max_message_size_bytes // If a log message is larger than this byte limit, the overflow bytes will be truncated. DefaultMaxMessageSizeBytes = 900 * 1000 // DefaultNetworkPathTimeout defines the default timeout for a network path test DefaultNetworkPathTimeout = 1000 // DefaultNetworkPathMaxTTL defines the default maximum TTL for traceroute tests DefaultNetworkPathMaxTTL = 30 // DefaultNetworkPathStaticPathTracerouteQueries defines the default number of traceroute queries for static path DefaultNetworkPathStaticPathTracerouteQueries = 3 // DefaultNetworkPathStaticPathE2eQueries defines the default number of end-to-end queries for static path DefaultNetworkPathStaticPathE2eQueries = 50 )
const ( // Metrics type covers series & sketches Metrics string = "metrics" // Logs type covers all outgoing logs Logs string = "logs" )
const ( // DefaultUpdaterLogFile is the default updater log file DefaultUpdaterLogFile = "/var/log/datadog/updater.log" // DefaultSecurityAgentLogFile points to the log file that will be used by the security-agent if not configured DefaultSecurityAgentLogFile = "/var/log/datadog/security-agent.log" // DefaultProcessAgentLogFile is the default process-agent log file DefaultProcessAgentLogFile = "/var/log/datadog/process-agent.log" // DefaultOTelAgentLogFile is the default otel-agent log file DefaultOTelAgentLogFile = "/var/log/datadog/otel-agent.log" // DefaultHostProfilerLogFile is the default host-profiler log file DefaultHostProfilerLogFile = "/var/log/datadog/host-profiler.log" //DefaultStreamlogsLogFile points to the stream logs log file that will be used if not configured DefaultStreamlogsLogFile = "/var/log/datadog/streamlogs_info/streamlogs.log" )
const ( OTLPSection = "otlp_config" OTLPTracePort = OTLPSection + ".traces.internal_port" OTLPTracesEnabled = OTLPSection + ".traces.enabled" OTLPLogsEnabled = OTLPSection + ".logs.enabled" OTLPReceiverSubSectionKey = "receiver" OTLPReceiverSection = OTLPSection + "." + OTLPReceiverSubSectionKey OTLPMetrics = OTLPSection + ".metrics" OTLPMetricsEnabled = OTLPMetrics + ".enabled" OTLPDebug = OTLPSection + "." + "debug" )
OTLP configuration paths.
const ( // DefaultGRPCConnectionTimeoutSecs sets the default value for timeout when connecting to the agent DefaultGRPCConnectionTimeoutSecs = 60 // DefaultProcessQueueSize is the default max amount of process-agent checks that can be buffered in memory if the forwarder can't consume them fast enough (e.g. due to network disruption) // This can be fairly high as the input should get throttled by queue bytes first. // Assuming we generate ~8 checks/minute (for process/network), this should allow buffering of ~30 minutes of data assuming it fits within the queue bytes memory budget DefaultProcessQueueSize = 256 // DefaultProcessRTQueueSize is the default max amount of process-agent realtime checks that can be buffered in memory // We set a small queue size for real-time message because they get staled very quickly, thus we only keep the latest several payloads DefaultProcessRTQueueSize = 5 // DefaultProcessQueueBytes is the default amount of process-agent check data (in bytes) that can be buffered in memory // Allow buffering up to 60 megabytes of payload data in total DefaultProcessQueueBytes = 60 * 1000 * 1000 // DefaultProcessMaxPerMessage is the default maximum number of processes, or containers per message. Note: Only change if the defaults are causing issues. DefaultProcessMaxPerMessage = 100 // ProcessMaxPerMessageLimit is the maximum allowed value for maximum number of processes, or containers per message. ProcessMaxPerMessageLimit = 10000 // DefaultProcessMaxMessageBytes is the default max for size of a message containing processes or container data. Note: Only change if the defaults are causing issues. DefaultProcessMaxMessageBytes = 1000000 // ProcessMaxMessageBytesLimit is the maximum allowed value for the maximum size of a message containing processes or container data. ProcessMaxMessageBytesLimit = 4000000 // DefaultProcessExpVarPort is the default port used by the process-agent expvar server DefaultProcessExpVarPort = 6062 // DefaultProcessCmdPort is the default port used by process-agent to run a runtime settings server DefaultProcessCmdPort = 6162 // DefaultProcessEntityStreamPort is the default port used by the process-agent to expose Process Entities DefaultProcessEntityStreamPort = 6262 // DefaultProcessEndpoint is the default endpoint for the process agent to send payloads to DefaultProcessEndpoint = "https://process.datadoghq.com." // DefaultProcessEventsEndpoint is the default endpoint for the process agent to send event payloads to DefaultProcessEventsEndpoint = "https://process-events.datadoghq.com." // DefaultProcessEventStoreMaxItems is the default maximum amount of events that can be stored in the Event Store DefaultProcessEventStoreMaxItems = 200 // DefaultProcessEventStoreMaxPendingPushes is the default amount of pending push operations can be handled by the Event Store DefaultProcessEventStoreMaxPendingPushes = 10 // DefaultProcessEventStoreMaxPendingPulls is the default amount of pending pull operations can be handled by the Event Store DefaultProcessEventStoreMaxPendingPulls = 10 // DefaultProcessEventStoreStatsInterval is the default frequency at which the event store sends stats about expired events, in seconds DefaultProcessEventStoreStatsInterval = 20 // DefaultProcessEventsMinCheckInterval is the minimum interval allowed for the process_events check DefaultProcessEventsMinCheckInterval = time.Second // DefaultProcessEventsCheckInterval is the default interval used by the process_events check DefaultProcessEventsCheckInterval = 10 * time.Second // DefaultProcessDiscoveryHintFrequency is the default frequency in terms of number of checks which we send a process discovery hint DefaultProcessDiscoveryHintFrequency = 60 )
const DefaultSecurityAgentCmdPort = 5010
DefaultSecurityAgentCmdPort is the default port used by security-agent to run a runtime settings server
const Traces string = "traces"
Traces specifies the data type used for Vector override. See https://vector.dev/docs/reference/configuration/sources/datadog_agent/ for additional details.
Variables ¶
var ( // DefaultSystemProbeAddress is the default unix socket path to be used for connecting to the system probe DefaultSystemProbeAddress = filepath.Join(InstallPath, "run/sysprobe.sock") // DefaultDDAgentBin the process agent's binary DefaultDDAgentBin = filepath.Join(InstallPath, "bin/agent/agent") )
var DefaultPrivateIPCIDRs = []string{
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"0.0.0.0/8",
"127.0.0.0/8",
"169.254.0.0/16",
"192.0.0.0/24",
"192.0.2.0/24",
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"224.0.0.0/4",
"240.0.0.0/4",
"100.64.0.0/10",
"fc00::/7",
"::1/128",
}
DefaultPrivateIPCIDRs is a list of private IP CIDRs that are used to determine if an IP is private or not.
var ( // InstallPath is the default install path for the agent // It might be overridden at build time InstallPath = "/opt/datadog-agent" )
Variables that are overridden at init
var StandardJMXIntegrations = map[string]struct{}{
"activemq": {},
"activemq_58": {},
"cassandra": {},
"jmx": {},
"presto": {},
"solr": {},
"tomcat": {},
"kafka": {},
}
StandardJMXIntegrations is the list of standard jmx integrations. This list is used by the Agent to determine if an integration is JMXFetch-based, based only on the integration name. DEPRECATED: this list is only used for backward compatibility with older JMXFetch integration configs. All JMXFetch integrations should instead define `is_jmx: true` at the init_config or instance level.
var StandardStatsdPrefixes = []string{
"datadog.agent",
"datadog.dogstatsd",
"datadog.process",
"datadog.trace_agent",
"datadog.tracer",
"activemq",
"activemq_58",
"airflow",
"cassandra",
"confluent",
"hazelcast",
"hive",
"ignite",
"jboss",
"jvm",
"kafka",
"presto",
"sidekiq",
"solr",
"tomcat",
"runtime",
}
StandardStatsdPrefixes is a list of the statsd prefixes used by the agent and its components
var ( // StartTime is the agent startup time StartTime = time.Now() )
Variables to initialize at start time
Functions ¶
func FleetConfigOverride ¶ added in v0.68.0
func FleetConfigOverride(_ pkgconfigmodel.Config)
FleetConfigOverride is a no-op on Linux
func GetDefaultSecurityProfilesDir ¶ added in v0.55.0
func GetDefaultSecurityProfilesDir() string
GetDefaultSecurityProfilesDir is the default directory used to store Security Profiles by the runtime security module
func GetIPCAddress ¶
func GetIPCAddress(config pkgconfigmodel.Reader) (string, error)
GetIPCAddress returns the IPC address or an error if the address is not local
func GetProcessAPIAddressPort ¶
func GetProcessAPIAddressPort(config pkgconfigmodel.Reader) (string, error)
GetProcessAPIAddressPort returns the API endpoint of the process agent
func GetSecurityAgentAPIAddressPort ¶ added in v0.55.0
func GetSecurityAgentAPIAddressPort(config pkgconfigmodel.Reader) (string, error)
GetSecurityAgentAPIAddressPort returns the API endpoint of the security agent
func GlobalConfigBuilder ¶ added in v0.71.0
func GlobalConfigBuilder() pkgconfigmodel.BuildableConfig
GlobalConfigBuilder returns a builder appropriate for initializing the config. It should not be used in most places, except for code that builds the config from scratch.
func GlobalSystemProbeConfigBuilder ¶ added in v0.71.0
func GlobalSystemProbeConfigBuilder() pkgconfigmodel.BuildableConfig
GlobalSystemProbeConfigBuilder returns a builder for the system probe config
func InitConfig ¶
func InitConfig(config pkgconfigmodel.Setup)
InitConfig initializes the config defaults on a config used by all agents (in particular more than just the serverless agent).
func InitSystemProbeConfig ¶
func InitSystemProbeConfig(cfg pkgconfigmodel.Setup)
InitSystemProbeConfig declares all the configuration values normally read from system-probe.yaml.
func IsCLCRunner ¶
func IsCLCRunner(config pkgconfigmodel.Reader) bool
IsCLCRunner returns whether the Agent is in cluster check runner mode
func LoadDatadog ¶ added in v0.73.0
func LoadDatadog(config pkgconfigmodel.Config, secretResolver secrets.Component, additionalEnvVars []string) error
LoadDatadog reads config files and initializes config with decrypted secrets
func LoadProxyFromEnv ¶
func LoadProxyFromEnv(config pkgconfigmodel.ReaderWriter)
LoadProxyFromEnv overrides the proxy settings with environment variables
func LoadSystemProbe ¶ added in v0.73.0
func LoadSystemProbe(config pkgconfigmodel.Config, additionalKnownEnvVars []string) error
LoadSystemProbe reads config files and initializes config with decrypted secrets for system-probe
func Merge ¶
func Merge(configPaths []string, config pkgconfigmodel.Config) error
Merge will merge additional configuration into an existing configuration
func SetDatadog ¶ added in v0.55.0
func SetDatadog(cfg pkgconfigmodel.BuildableConfig)
SetDatadog sets the the reference to the agent configuration. This is currently used by the legacy converter and config mocks and should not be user anywhere else. Once the legacy converter and mock have been migrated we will remove this function.
func SetSystemProbe ¶ added in v0.57.0
func SetSystemProbe(cfg pkgconfigmodel.BuildableConfig)
SetSystemProbe sets the the reference to the systemProbe configuration. This is currently used by the config mocks and should not be user anywhere else. Once the mocks have been migrated we will remove this function.
func SystemProbe ¶
func SystemProbe() pkgconfigmodel.Config
SystemProbe returns the current SystemProbe configuration
Types ¶
type ChangeChecker ¶ added in v0.59.0
type ChangeChecker struct {
// contains filtered or unexported fields
}
ChangeChecker checks the state of `config.Datadog` did not change between `NewChangeChecker()“ and `HasChanged()`. It is designed to be used in `TestMain` function as follow:
func TestMain(m *testing.M) {
checker := testutil.NewConfigChangeChecker()
exit := m.Run()
if checker.HasChanged() {
os.Exit(1)
}
os.Exit(exit)
}
func NewChangeChecker ¶ added in v0.59.0
func NewChangeChecker() *ChangeChecker
NewChangeChecker creates a new instance of ConfigChangeChecker
func (*ChangeChecker) HasChanged ¶ added in v0.59.0
func (c *ChangeChecker) HasChanged() bool
HasChanged returns whether `config.Datadog` changed since `NewConfigChangeChecker`. If some changes are detected this function displays on the standard error what keys changed.
type ConfigurationProviders ¶
type ConfigurationProviders struct {
Name string `mapstructure:"name"`
Polling bool `mapstructure:"polling"`
PollInterval string `mapstructure:"poll_interval"`
TemplateURL string `mapstructure:"template_url"`
TemplateDir string `mapstructure:"template_dir"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
CAFile string `mapstructure:"ca_file"`
CAPath string `mapstructure:"ca_path"`
CertFile string `mapstructure:"cert_file"`
KeyFile string `mapstructure:"key_file"`
Token string `mapstructure:"token"`
GraceTimeSeconds int `mapstructure:"grace_time_seconds"`
DegradedDeadlineMinutes int `mapstructure:"degraded_deadline_minutes"`
}
ConfigurationProviders helps unmarshalling `config_providers` config param
type Listeners ¶
Listeners helps unmarshalling `listeners` config param
func (*Listeners) IsProviderEnabled ¶
IsProviderEnabled returns whether a config provider is enabled
func (*Listeners) SetEnabledProviders ¶
SetEnabledProviders registers the enabled config providers in the listener config
type UnexpectedUnicodeCodepoint ¶
type UnexpectedUnicodeCodepoint struct {
// contains filtered or unexported fields
}
UnexpectedUnicodeCodepoint contains specifics about an occurrence of an unexpected unicode codepoint
func FindUnexpectedUnicode ¶
func FindUnexpectedUnicode(input string) []UnexpectedUnicodeCodepoint
FindUnexpectedUnicode reports any _unexpected_ unicode codepoints found in the given 'input' string Unexpected here generally means invisible whitespace and control chars