Documentation
¶
Overview ¶
Package confgenerator represents the Ops Agent configuration and provides functions to generate subagents configuration from unified agent.
Package confgenerator provides functions to generate subagents configuration from unified agent.
Index ¶
- Constants
- Variables
- func ContextWithExperiments(ctx context.Context, experiments map[string]bool) context.Context
- func ConvertGCMOtelExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline
- func ConvertGCMSystemExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline
- func ConvertPrometheusExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline
- func ConvertToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context, isPrometheus bool, ...) otel.ReceiverPipeline
- func DBPath(tag string) string
- func GetSortedKeys[V any](m map[string]V) []string
- func ParseExperimentalFeatures(features string) map[string]bool
- func RegisterLoggingFilesProcessorMacro[LPM LoggingProcessorMacro](filesMixinConstructor func() LoggingReceiverFilesMixin, ...)
- func RegisterLoggingProcessorMacro[LPM LoggingProcessorMacro](platforms ...platform.Type)
- func RegisterLoggingReceiverMacro[LRM LoggingReceiverMacro](constructor func() LRM, platforms ...platform.Type)
- func ReplaceLoggingProcessorMacro[LPM LoggingProcessorMacro](platforms ...platform.Type)
- func WriteConfigFile(content []byte, path string) error
- type AgentSelfMetrics
- func (r AgentSelfMetrics) AddSelfMetricsPipelines(receiverPipelines map[string]otel.ReceiverPipeline, ...)
- func (r AgentSelfMetrics) FluentBitPipelineProcessors() []otel.Component
- func (r AgentSelfMetrics) LoggingMetricsPipelineProcessors() []otel.Component
- func (r AgentSelfMetrics) OpsAgentPipeline(ctx context.Context) otel.ReceiverPipeline
- func (r AgentSelfMetrics) OtelPipelineProcessors(ctx context.Context) []otel.Component
- func (r AgentSelfMetrics) PrometheusMetricsPipeline(ctx context.Context) otel.ReceiverPipeline
- type Combined
- type CombinedReceiver
- type Component
- type ConfigComponent
- type CustomFeature
- type CustomFeatures
- type CustomProcessorValidator
- type Feature
- type Global
- type InternalLoggingProcessor
- type InternalLoggingProcessorMerger
- type InternalLoggingReceiver
- type InternalOTelProcessor
- type InternalOTelReceiver
- type LogFileRotation
- type Logging
- type LoggingNetworkReceiver
- type LoggingProcessor
- type LoggingProcessorExcludeLogs
- type LoggingProcessorMacro
- type LoggingProcessorModifyFields
- type LoggingProcessorNestWildcard
- type LoggingProcessorParseJson
- type LoggingProcessorParseMultilineRegex
- type LoggingProcessorParseRegex
- type LoggingProcessorParseRegexComplex
- type LoggingProcessorWindowsEventLogRawXML
- type LoggingProcessorWindowsEventLogV1
- type LoggingProcessorWindowsEventLogV2
- type LoggingReceiver
- type LoggingReceiverFiles
- func (r LoggingReceiverFiles) Components(ctx context.Context, tag string) []fluentbit.Component
- func (r LoggingReceiverFiles) Expand(_ context.Context) (InternalLoggingReceiver, []InternalLoggingProcessor)
- func (r LoggingReceiverFiles) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
- func (r LoggingReceiverFiles) Type() string
- type LoggingReceiverFilesMixin
- func (r LoggingReceiverFilesMixin) Components(ctx context.Context, tag string) []fluentbit.Component
- func (r LoggingReceiverFilesMixin) MergeInternalLoggingProcessor(p InternalLoggingProcessor) (InternalLoggingReceiver, InternalLoggingProcessor)
- func (r LoggingReceiverFilesMixin) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
- type LoggingReceiverFluentForward
- func (r LoggingReceiverFluentForward) Components(ctx context.Context, tag string) []fluentbit.Component
- func (r LoggingReceiverFluentForward) GetListenPort() uint16
- func (r LoggingReceiverFluentForward) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
- func (r LoggingReceiverFluentForward) Type() string
- type LoggingReceiverMacro
- type LoggingReceiverSyslog
- type LoggingReceiverSystemd
- type LoggingReceiverTCP
- type LoggingReceiverWindowsEventLog
- func (r LoggingReceiverWindowsEventLog) Components(ctx context.Context, tag string) []fluentbit.Component
- func (r LoggingReceiverWindowsEventLog) IsDefaultVersion() bool
- func (r LoggingReceiverWindowsEventLog) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
- func (r LoggingReceiverWindowsEventLog) Type() string
- type LoggingService
- type Metrics
- type MetricsProcessor
- type MetricsProcessorMerger
- type MetricsReceiver
- type MetricsReceiverShared
- type MetricsReceiverSharedCluster
- type MetricsReceiverSharedCollectJVM
- type MetricsReceiverSharedJVM
- func (m MetricsReceiverSharedJVM) ConfigurePipelines(targetSystem string, processors []otel.Component) ([]otel.ReceiverPipeline, error)
- func (m MetricsReceiverSharedJVM) WithDefaultAdditionalJars(defaultAdditionalJars ...string) MetricsReceiverSharedJVM
- func (m MetricsReceiverSharedJVM) WithDefaultEndpoint(defaultEndpoint string) MetricsReceiverSharedJVM
- type MetricsReceiverSharedTLS
- type MetricsService
- type ModifyField
- type MultilineRule
- type OTelProcessor
- type OTelReceiver
- type ParseMultiline
- type ParseMultilineGroup
- type ParserShared
- func (p ParserShared) Component(tag, uid string) (fluentbit.Component, string)
- func (p ParserShared) FluentBitSpecialFieldsStatements(ctx context.Context) ottl.Statements
- func (p ParserShared) TimestampStatements() (ottl.Statements, error)
- func (p ParserShared) TypesStatements() (ottl.Statements, error)
- type Pipeline
- type PipelineInstance
- type PrometheusMetrics
- func (r PrometheusMetrics) AllowCustomProcessors() bool
- func (r PrometheusMetrics) ExtractFeatures() ([]CustomFeature, error)
- func (r PrometheusMetrics) ListAllFeatures() []string
- func (r PrometheusMetrics) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
- func (r PrometheusMetrics) Type() string
- type RegexParser
- type Traces
- type TracesReceiver
- type TracesService
- type TrackingOverrideMapError
- type UnifiedConfig
- func (uc *UnifiedConfig) DeepCopy(ctx context.Context) (*UnifiedConfig, error)
- func (uc *UnifiedConfig) GenerateFilesFromConfig(ctx context.Context, service, logsDir, stateDir, outDir string) error
- func (uc *UnifiedConfig) GenerateFluentBitConfigs(ctx context.Context, logsDir string, stateDir string) (map[string]string, error)
- func (uc *UnifiedConfig) GenerateOtelConfig(ctx context.Context, outDir, stateDir string) (string, error)
- func (uc *UnifiedConfig) HasCombined() bool
- func (uc *UnifiedConfig) HasLogging() bool
- func (uc *UnifiedConfig) HasMetrics() bool
- func (uc *UnifiedConfig) LoggingReceivers(ctx context.Context) (map[string]Component, error)
- func (uc *UnifiedConfig) MetricsReceivers() (map[string]MetricsReceiver, error)
- func (uc *UnifiedConfig) OTelLoggingReceivers(ctx context.Context) (map[string]OTelReceiver, error)
- func (uc *UnifiedConfig) OTelLoggingSupported(ctx context.Context) bool
- func (uc *UnifiedConfig) Pipelines(ctx context.Context) ([]PipelineInstance, error)
- func (uc *UnifiedConfig) String() string
- func (uc *UnifiedConfig) TracesReceivers() (map[string]TracesReceiver, error)
- func (uc *UnifiedConfig) Validate(ctx context.Context) error
- func (uc *UnifiedConfig) ValidateCombined() error
- func (uc *UnifiedConfig) ValidateLogging() error
- func (uc *UnifiedConfig) ValidateMetrics(ctx context.Context) error
- func (uc *UnifiedConfig) ValidateTraces() error
- type VersionedReceivers
Constants ¶
const ( BackendOTel pipelineBackend = iota BackendFluentBit )
const HttpRequestKey = "logging.googleapis.com/httpRequest"
const InstrumentationSourceLabel = `labels."logging.googleapis.com/instrumentation_source"`
Variables ¶
var ( ErrTrackingInlineStruct = errors.New("cannot have tracking on inline struct") ErrTrackingOverrideStruct = errors.New("struct that has tracking tag must not be empty") )
var CombinedReceiverTypes = &componentTypeRegistry[CombinedReceiver, combinedReceiverMap]{
Subagent: "generic", Kind: "receiver",
}
var FindJarPath = func() (string, error) { jarName := "opentelemetry-java-contrib-jmx-metrics.jar" executableDir, err := osext.ExecutableFolder() if err != nil { return jarName, fmt.Errorf("could not determine binary path for jvm receiver: %w", err) } if runtime.GOOS != "windows" { return filepath.Join(executableDir, "../subagents/opentelemetry-collector/", jarName), nil } return filepath.Join(executableDir, jarName), nil }
var LegacyBuiltinProcessors = map[string]LoggingProcessor{ "lib:default_message_parser": &LoggingProcessorParseRegex{ Regex: `^(?<message>.*)$`, }, "lib:apache": &LoggingProcessorParseRegex{ Regex: `^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$`, ParserShared: ParserShared{ TimeKey: "time", TimeFormat: "%d/%b/%Y:%H:%M:%S %z", }, }, "lib:apache2": &LoggingProcessorParseRegex{ Regex: `^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>.*)")?$`, ParserShared: ParserShared{ TimeKey: "time", TimeFormat: "%d/%b/%Y:%H:%M:%S %z", }, }, "lib:apache_error": &LoggingProcessorParseRegex{ Regex: `^\[[^ ]* (?<time>[^\]]*)\] \[(?<level>[^\]]*)\](?: \[pid (?<pid>[^\]]*)\])?( \[client (?<client>[^\]]*)\])? (?<message>.*)$`, }, "lib:mongodb": &LoggingProcessorParseRegex{ Regex: `^(?<time>[^ ]*)\s+(?<severity>\w)\s+(?<component>[^ ]+)\s+\[(?<context>[^\]]+)]\s+(?<message>.*?) *(?<ms>(\d+))?(:?ms)?$`, ParserShared: ParserShared{ TimeKey: "time", TimeFormat: "%Y-%m-%dT%H:%M:%S.%L", }, }, "lib:nginx": &LoggingProcessorParseRegex{ Regex: `^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")`, ParserShared: ParserShared{ TimeKey: "time", TimeFormat: "%d/%b/%Y:%H:%M:%S %z", }, }, "lib:syslog-rfc5424": &LoggingProcessorParseRegex{ Regex: `^\<(?<pri>[0-9]{1,5})\>1 (?<time>[^ ]+) (?<host>[^ ]+) (?<ident>[^ ]+) (?<pid>[-0-9]+) (?<msgid>[^ ]+) (?<extradata>(\[(.*?)\]|-)) (?<message>.+)$`, ParserShared: ParserShared{ TimeKey: "time", TimeFormat: "%Y-%m-%dT%H:%M:%S.%L%Z", }, }, "lib:syslog-rfc3164": &LoggingProcessorParseRegex{ Regex: `/^\<(?<pri>[0-9]+)\>(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$/`, ParserShared: ParserShared{ TimeKey: "time", TimeFormat: "%b %d %H:%M:%S", }, }, }
var LoggingProcessorTypes = &componentTypeRegistry[LoggingProcessor, loggingProcessorMap]{
Subagent: "logging", Kind: "processor",
}
var LoggingReceiverTypes = &componentTypeRegistry[LoggingReceiver, loggingReceiverMap]{
Subagent: "logging", Kind: "receiver",
}
var MetricsProcessorTypes = &componentTypeRegistry[MetricsProcessor, metricsProcessorMap]{
Subagent: "metrics", Kind: "processor",
}
var MetricsReceiverTypes = &componentTypeRegistry[MetricsReceiver, metricsReceiverMap]{
Subagent: "metrics", Kind: "receiver",
}
Functions ¶
func ContextWithExperiments ¶
func ConvertGCMOtelExporterToOtlpExporter ¶
func ConvertGCMOtelExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline
func ConvertGCMSystemExporterToOtlpExporter ¶
func ConvertGCMSystemExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline
func ConvertPrometheusExporterToOtlpExporter ¶
func ConvertPrometheusExporterToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context) otel.ReceiverPipeline
func ConvertToOtlpExporter ¶
func ConvertToOtlpExporter(pipeline otel.ReceiverPipeline, ctx context.Context, isPrometheus bool, isSystem bool) otel.ReceiverPipeline
func GetSortedKeys ¶
func RegisterLoggingFilesProcessorMacro ¶
func RegisterLoggingFilesProcessorMacro[LPM LoggingProcessorMacro](filesMixinConstructor func() LoggingReceiverFilesMixin, platforms ...platform.Type)
RegisterLoggingFilesProcessorMacro registers a LoggingProcessorMacro as a processor type and also registers a receiver that combines a LoggingReceiverFilesMixin with that LoggingProcessorMacro.
func RegisterLoggingProcessorMacro ¶
func RegisterLoggingProcessorMacro[LPM LoggingProcessorMacro](platforms ...platform.Type)
func RegisterLoggingReceiverMacro ¶
func RegisterLoggingReceiverMacro[LRM LoggingReceiverMacro](constructor func() LRM, platforms ...platform.Type)
func ReplaceLoggingProcessorMacro ¶
func ReplaceLoggingProcessorMacro[LPM LoggingProcessorMacro](platforms ...platform.Type)
func WriteConfigFile ¶
Types ¶
type AgentSelfMetrics ¶
type AgentSelfMetrics struct {
MetricsVersionLabel string
LoggingVersionLabel string
FluentBitPort int
OtelPort int
OtelRuntimeDir string
OtelLogging bool
}
AgentSelfMetrics provides the agent.googleapis.com/agent/ metrics. It is never referenced in the config file, and instead is forcibly added in confgenerator.go. Therefore, it does not need to implement any interfaces.
func (AgentSelfMetrics) AddSelfMetricsPipelines ¶
func (r AgentSelfMetrics) AddSelfMetricsPipelines(receiverPipelines map[string]otel.ReceiverPipeline, pipelines map[string]otel.Pipeline, ctx context.Context)
func (AgentSelfMetrics) FluentBitPipelineProcessors ¶
func (r AgentSelfMetrics) FluentBitPipelineProcessors() []otel.Component
func (AgentSelfMetrics) LoggingMetricsPipelineProcessors ¶
func (r AgentSelfMetrics) LoggingMetricsPipelineProcessors() []otel.Component
func (AgentSelfMetrics) OpsAgentPipeline ¶
func (r AgentSelfMetrics) OpsAgentPipeline(ctx context.Context) otel.ReceiverPipeline
func (AgentSelfMetrics) OtelPipelineProcessors ¶
func (r AgentSelfMetrics) OtelPipelineProcessors(ctx context.Context) []otel.Component
func (AgentSelfMetrics) PrometheusMetricsPipeline ¶
func (r AgentSelfMetrics) PrometheusMetricsPipeline(ctx context.Context) otel.ReceiverPipeline
type Combined ¶
type Combined struct {
Receivers combinedReceiverMap `yaml:"receivers,omitempty" validate:"dive,keys,startsnotwith=lib:"`
}
type CombinedReceiver ¶
type CombinedReceiver interface {
// TODO: Add more types of signals
MetricsReceiver
}
type Component ¶
type Component interface {
// Type returns the component type string as used in the configuration file (e.g. "hostmetrics")
Type() string
}
type ConfigComponent ¶
type ConfigComponent struct {
Type string `yaml:"type" validate:"required" tracking:""`
}
ConfigComponent holds the shared configuration fields that all components have. It is also used by itself when unmarshaling a component's configuration.
type CustomFeature ¶
type CustomFeatures ¶
type CustomFeatures interface {
// ExtractFeatures returns a list of features that will be tracked for this component.
ExtractFeatures() ([]CustomFeature, error)
// ListAllFeatures returns a list of all features that could be tracked for this component.
// This lists all the possible features that could be tracked for this component, but some of these
// features may not be tracked when not used by the component.
ListAllFeatures() []string
}
CustomFeatures is the interface that components must implement to be able to track features not captured by the `tracking` struct tag.
type CustomProcessorValidator ¶
type CustomProcessorValidator interface {
AllowCustomProcessors() bool
}
CustomProcessorValidator checks if receiver or pipeline allows Ops Agent to have processors Ops Agent cannot have processors if the receiver is of prometheus type, or if it is an OTLP receiver that exports metrics to googlemanagedprometheus
type Feature ¶
type Feature struct {
// Module defines the sub-agent: metrics or logging
Module string
// Kind defines the kind: receivers or processors
Kind string
// Type from Component.Type()
Type string
// Key: set of keys that will be joined together for feature tracking metrics
Key []string
// Value defined from fields of UnifiedConfig.
Value string
}
func ExtractFeatures ¶
func ExtractFeatures(ctx context.Context, userUc, mergedUc *UnifiedConfig) ([]Feature, error)
ExtractFeatures fields that containing a tracking tag will be tracked. Automatic collection of bool or int fields. Any value that exists on tracking tag will be used instead of value from UnifiedConfig.
type Global ¶
type Global struct {
DefaultSelfLogFileCollection *bool `yaml:"default_self_log_file_collection,omitempty"`
DefaultLogFileRotation *LogFileRotation `yaml:"default_self_log_file_rotation,omitempty"`
}
func (*Global) GetDefaultSelfLogFileCollection ¶
Get whether self log collection should be enabled. Defaults to true if unset.
type InternalLoggingProcessor ¶
type InternalLoggingProcessor interface {
// Components returns fluentbit components that implement this processor.
// tag is the log tag that should be matched by those components, and uid is a string which should be used when needed to generate unique names.
Components(ctx context.Context, tag string, uid string) []fluentbit.Component
}
InternalLoggingProcessor implements the methods required to define a logging processor pipeline.
type InternalLoggingProcessorMerger ¶
type InternalLoggingProcessorMerger interface {
// MergeInternalLoggingProcessor attempts to merge p into the current receiver.
// It returns the new receiver; and a potentially modified processor or nil.
MergeInternalLoggingProcessor(p InternalLoggingProcessor) (InternalLoggingReceiver, InternalLoggingProcessor)
}
type InternalLoggingReceiver ¶
type InternalLoggingReceiver interface {
// Components returns fluentbit components that implement this receiver.
// tag is the log tag that is assigned to the collected logs.
Components(ctx context.Context, tag string) []fluentbit.Component
}
InternalLoggingReceiver implements all the methods required to describe a logging receiver pipeline.
type InternalOTelProcessor ¶
type InternalOTelReceiver ¶
type InternalOTelReceiver interface {
Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
}
type LogFileRotation ¶
type LogFileRotation struct {
Enabled *bool `yaml:"enabled"`
MaxFileSize *int `yaml:"max_file_size_megabytes" validate:"omitempty,gte=1"`
BackupCount *int `yaml:"backup_count" validate:"omitempty,gte=1"`
}
func (*LogFileRotation) GetBackupCount ¶
func (c *LogFileRotation) GetBackupCount() int
Get the maximum number of backups for logs. If not set or negative, defaults to 1 backup (2 files including the file that is being logged to).
func (*LogFileRotation) GetEnabled ¶
func (c *LogFileRotation) GetEnabled() bool
Get whether log rotation should be enabled. Defaults to true if unset.
func (*LogFileRotation) GetMaxFileSize ¶
func (c *LogFileRotation) GetMaxFileSize() int
Get the maximum file size for logs in megabytes. If not set or non-positive, defaults to 400 MB.
type Logging ¶
type Logging struct {
Receivers loggingReceiverMap `yaml:"receivers,omitempty" validate:"dive,keys,startsnotwith=lib:"`
Processors loggingProcessorMap `yaml:"processors,omitempty" validate:"dive,keys,startsnotwith=lib:"`
// Exporters are deprecated and ignored, so do not have any validation.
Exporters map[string]interface{} `yaml:"exporters,omitempty"`
Service *LoggingService `yaml:"service"`
}
type LoggingNetworkReceiver ¶
type LoggingNetworkReceiver interface {
LoggingReceiver
GetListenPort() uint16
}
Logging receivers that listen on a port of the host
type LoggingProcessor ¶
type LoggingProcessor interface {
Component
InternalLoggingProcessor
}
type LoggingProcessorExcludeLogs ¶
type LoggingProcessorExcludeLogs struct {
ConfigComponent `yaml:",inline"`
MatchAny []string `yaml:"match_any" validate:"required,dive,filter"`
}
A LoggingProcessorExcludeLogs filters out logs according to a pattern.
func (LoggingProcessorExcludeLogs) Components ¶
func (LoggingProcessorExcludeLogs) Processors ¶
func (LoggingProcessorExcludeLogs) Type ¶
func (p LoggingProcessorExcludeLogs) Type() string
type LoggingProcessorMacro ¶
type LoggingProcessorMacro interface {
Type() string
// Expand returns a slice of logging processors that implement this processor. This is an intermediate step for processors that can be implemented in a subagent-agnostic way.
Expand(ctx context.Context) []InternalLoggingProcessor
}
LoggingProcessorMacro is a logging component that generates other Ops Agent processors as its implementation.
type LoggingProcessorModifyFields ¶
type LoggingProcessorModifyFields struct {
ConfigComponent `yaml:",inline"`
Fields map[string]*ModifyField `yaml:"fields" validate:"dive,keys,field,distinctfield,writablefield,endkeys" tracking:"-"`
// For use by other processors, if set this will clear out `jsonPayload`, leaving only the fields set above.
// Only supported in OTel.
EmptyBody bool `yaml:"-" tracking:"-"`
}
func (LoggingProcessorModifyFields) Components ¶
func (LoggingProcessorModifyFields) Processors ¶
func (LoggingProcessorModifyFields) Type ¶
func (p LoggingProcessorModifyFields) Type() string
type LoggingProcessorNestWildcard ¶
func (LoggingProcessorNestWildcard) Components ¶
type LoggingProcessorParseJson ¶
type LoggingProcessorParseJson struct {
ConfigComponent `yaml:",inline"`
Field string `yaml:"field,omitempty" validate:"omitempty,fieldlegacy"`
}
A LoggingProcessorParseJson parses the specified field as JSON.
func (LoggingProcessorParseJson) Components ¶
func (LoggingProcessorParseJson) Processors ¶
func (LoggingProcessorParseJson) Type ¶
func (r LoggingProcessorParseJson) Type() string
type LoggingProcessorParseMultilineRegex ¶
type LoggingProcessorParseMultilineRegex struct {
LoggingProcessorParseRegexComplex
Rules []MultilineRule
}
A LoggingProcessorParseMultilineRegex applies a set of regex rules to the specified lines, storing the named capture groups as keys in the log record.
# # Regex rules for multiline parsing # --------------------------------- # # configuration hints: # # - first state always has the name: start_state # - every field in the rule must be inside double quotes # # rules | state name | regex pattern | next state # ------|---------------|-------------------------------------------- rule "start_state" "/(Dec \d+ \d+\:\d+\:\d+)(.*)/" "cont" rule "cont" "/^\s+at.*/" "cont"
func (LoggingProcessorParseMultilineRegex) Components ¶
func (LoggingProcessorParseMultilineRegex) Processors ¶
type LoggingProcessorParseRegex ¶
type LoggingProcessorParseRegex struct {
ConfigComponent `yaml:",inline"`
Field string `yaml:"field,omitempty" validate:"omitempty,fieldlegacy"`
PreserveKey bool `yaml:"-"`
Regex string `yaml:"regex,omitempty" validate:"required"`
}
A LoggingProcessorParseRegex applies a regex to the specified field, storing the named capture groups as keys in the log record. This was maintained in addition to the parse_regex_complex to ensure backward compatibility with any existing configurations
func (LoggingProcessorParseRegex) Components ¶
func (LoggingProcessorParseRegex) Processors ¶
func (LoggingProcessorParseRegex) Type ¶
func (r LoggingProcessorParseRegex) Type() string
type LoggingProcessorParseRegexComplex ¶
type LoggingProcessorParseRegexComplex struct {
Field string
Parsers []RegexParser
}
A LoggingProcessorParseRegexComplex applies a set of regexes to the specified field, storing the named capture groups as keys in the log record.
func (LoggingProcessorParseRegexComplex) Components ¶
func (LoggingProcessorParseRegexComplex) Processors ¶
type LoggingProcessorWindowsEventLogRawXML ¶
type LoggingProcessorWindowsEventLogRawXML struct {
ConfigComponent `yaml:",inline"`
}
LoggingProcessorWindowsEventLogRawXML contains the otel logging processors for RenderAsXML=true.
func (LoggingProcessorWindowsEventLogRawXML) Components ¶
func (LoggingProcessorWindowsEventLogRawXML) Processors ¶
func (LoggingProcessorWindowsEventLogRawXML) Type ¶
func (r LoggingProcessorWindowsEventLogRawXML) Type() string
type LoggingProcessorWindowsEventLogV1 ¶
type LoggingProcessorWindowsEventLogV1 struct {
ConfigComponent `yaml:",inline"`
}
LoggingProcessorWindowsEventLogV1 contains the otel logging processors for ReceiverVersion=1.
func (LoggingProcessorWindowsEventLogV1) Components ¶
func (LoggingProcessorWindowsEventLogV1) Processors ¶
func (LoggingProcessorWindowsEventLogV1) Type ¶
func (r LoggingProcessorWindowsEventLogV1) Type() string
type LoggingProcessorWindowsEventLogV2 ¶
type LoggingProcessorWindowsEventLogV2 struct {
ConfigComponent `yaml:",inline"`
}
LoggingProcessorWindowsEventLogV2 contains the otel logging processors for ReceiverVersion=2.
func (LoggingProcessorWindowsEventLogV2) Components ¶
func (LoggingProcessorWindowsEventLogV2) Processors ¶
func (LoggingProcessorWindowsEventLogV2) Type ¶
func (r LoggingProcessorWindowsEventLogV2) Type() string
type LoggingReceiver ¶
type LoggingReceiver interface {
Component
InternalLoggingReceiver
}
type LoggingReceiverFiles ¶
type LoggingReceiverFiles struct {
ConfigComponent `yaml:",inline"`
// TODO: Use LoggingReceiverFilesMixin after figuring out the validation story.
IncludePaths []string `yaml:"include_paths" validate:"required,min=1"`
ExcludePaths []string `yaml:"exclude_paths,omitempty"`
WildcardRefreshInterval *time.Duration `yaml:"wildcard_refresh_interval,omitempty" validate:"omitempty,min=1s,multipleof_time=1s"`
RecordLogFilePath *bool `yaml:"record_log_file_path,omitempty"`
}
A LoggingReceiverFiles represents the user configuration for a file receiver (fluentbit's tail plugin).
func (LoggingReceiverFiles) Components ¶
func (LoggingReceiverFiles) Expand ¶
func (r LoggingReceiverFiles) Expand(_ context.Context) (InternalLoggingReceiver, []InternalLoggingProcessor)
func (LoggingReceiverFiles) Pipelines ¶
func (r LoggingReceiverFiles) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
func (LoggingReceiverFiles) Type ¶
func (r LoggingReceiverFiles) Type() string
type LoggingReceiverFilesMixin ¶
type LoggingReceiverFilesMixin struct {
IncludePaths []string `yaml:"include_paths,omitempty"`
ExcludePaths []string `yaml:"exclude_paths,omitempty"`
WildcardRefreshInterval *time.Duration `yaml:"wildcard_refresh_interval,omitempty" validate:"omitempty,min=1s,multipleof_time=1s"`
MultilineRules []MultilineRule `yaml:"-"`
BufferInMemory bool `yaml:"-"`
RecordLogFilePath *bool `yaml:"record_log_file_path,omitempty"`
// In transformation test mode, the file is read exactly once from the beginning, and then the process exits.
TransformationTest bool `yaml:"-" tracking:"-"`
}
func (LoggingReceiverFilesMixin) Components ¶
func (LoggingReceiverFilesMixin) MergeInternalLoggingProcessor ¶
func (r LoggingReceiverFilesMixin) MergeInternalLoggingProcessor(p InternalLoggingProcessor) (InternalLoggingReceiver, InternalLoggingProcessor)
func (LoggingReceiverFilesMixin) Pipelines ¶
func (r LoggingReceiverFilesMixin) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
type LoggingReceiverFluentForward ¶
type LoggingReceiverFluentForward struct {
ConfigComponent `yaml:",inline"`
ListenHost string `yaml:"listen_host,omitempty" validate:"omitempty,ip"`
ListenPort uint16 `yaml:"listen_port,omitempty"`
}
A LoggingReceiverFluentForward represents the configuration for a Forward Protocol receiver.
func (LoggingReceiverFluentForward) Components ¶
func (LoggingReceiverFluentForward) GetListenPort ¶
func (r LoggingReceiverFluentForward) GetListenPort() uint16
func (LoggingReceiverFluentForward) Pipelines ¶
func (r LoggingReceiverFluentForward) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
func (LoggingReceiverFluentForward) Type ¶
func (r LoggingReceiverFluentForward) Type() string
type LoggingReceiverMacro ¶
type LoggingReceiverMacro interface {
Type() string
// Expand returns a receiver and slice of logging processors that implement this receivers. This is an intermediate step for receivers that can be implemented in a subagent-agnostic way.
Expand(ctx context.Context) (InternalLoggingReceiver, []InternalLoggingProcessor)
}
LoggingReceiverMacro is a logging component that generates other Ops Agent receivers and processors as its implementation.
type LoggingReceiverSyslog ¶
type LoggingReceiverSyslog struct {
ConfigComponent `yaml:",inline"`
TransportProtocol string `yaml:"transport_protocol,omitempty" validate:"oneof=tcp udp"`
ListenHost string `yaml:"listen_host,omitempty" validate:"required,ip"`
ListenPort uint16 `yaml:"listen_port,omitempty" validate:"required"`
}
A LoggingReceiverSyslog represents the configuration for a syslog protocol receiver.
func (LoggingReceiverSyslog) Components ¶
func (LoggingReceiverSyslog) GetListenPort ¶
func (r LoggingReceiverSyslog) GetListenPort() uint16
func (LoggingReceiverSyslog) Pipelines ¶
func (r LoggingReceiverSyslog) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
func (LoggingReceiverSyslog) Type ¶
func (r LoggingReceiverSyslog) Type() string
type LoggingReceiverSystemd ¶
type LoggingReceiverSystemd struct {
ConfigComponent `yaml:",inline"`
}
A LoggingReceiverSystemd represents the user configuration for a Systemd/journald receiver.
func (LoggingReceiverSystemd) Components ¶
func (LoggingReceiverSystemd) Pipelines ¶
func (r LoggingReceiverSystemd) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
func (LoggingReceiverSystemd) Type ¶
func (r LoggingReceiverSystemd) Type() string
type LoggingReceiverTCP ¶
type LoggingReceiverTCP struct {
ConfigComponent `yaml:",inline"`
Format string `yaml:"format,omitempty" validate:"required,oneof=json"`
ListenHost string `yaml:"listen_host,omitempty" validate:"omitempty,ip"`
ListenPort uint16 `yaml:"listen_port,omitempty"`
}
A LoggingReceiverTCP represents the configuration for a TCP receiver.
func (LoggingReceiverTCP) Components ¶
func (LoggingReceiverTCP) GetListenPort ¶
func (r LoggingReceiverTCP) GetListenPort() uint16
func (LoggingReceiverTCP) Type ¶
func (r LoggingReceiverTCP) Type() string
type LoggingReceiverWindowsEventLog ¶
type LoggingReceiverWindowsEventLog struct {
ConfigComponent `yaml:",inline"`
Channels []string `yaml:"channels,omitempty,flow" validate:"required,winlogchannels"`
ReceiverVersion string `yaml:"receiver_version,omitempty" validate:"omitempty,oneof=1 2" tracking:""`
RenderAsXML bool `yaml:"render_as_xml,omitempty" tracking:""`
}
A LoggingReceiverWindowsEventLog represents the user configuration for a Windows event log receiver.
func (LoggingReceiverWindowsEventLog) Components ¶
func (LoggingReceiverWindowsEventLog) IsDefaultVersion ¶
func (r LoggingReceiverWindowsEventLog) IsDefaultVersion() bool
func (LoggingReceiverWindowsEventLog) Pipelines ¶
func (r LoggingReceiverWindowsEventLog) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
func (LoggingReceiverWindowsEventLog) Type ¶
func (r LoggingReceiverWindowsEventLog) Type() string
type LoggingService ¶
type LoggingService struct {
Compress string `yaml:"compress,omitempty" validate:"omitempty,oneof=gzip,experimental=log_compression"`
LogLevel string `yaml:"log_level,omitempty" validate:"omitempty,oneof=error warn info debug trace"`
Pipelines map[string]*Pipeline `validate:"dive,keys,startsnotwith=lib:"`
OTelLogging bool `yaml:"experimental_otel_logging,omitempty" validate:"omitempty,experimental=otel_logging"`
}
type Metrics ¶
type Metrics struct {
Receivers metricsReceiverMap `yaml:"receivers" validate:"dive,keys,startsnotwith=lib:"`
Processors metricsProcessorMap `yaml:"processors" validate:"dive,keys,startsnotwith=lib:"`
// Exporters are deprecated and ignored, so do not have any validation.
Exporters map[string]interface{} `yaml:"exporters,omitempty"`
Service *MetricsService `yaml:"service"`
}
type MetricsProcessor ¶
type MetricsProcessor interface {
OTelProcessor
}
type MetricsProcessorMerger ¶
type MetricsProcessorMerger interface {
// MergeMetricsProcessor attempts to merge p into the current receiver.
// It returns the new receiver; and true if the processor has been merged
// into the receiver completely
MergeMetricsProcessor(p MetricsProcessor) (MetricsReceiver, bool)
}
type MetricsReceiver ¶
type MetricsReceiver interface {
OTelReceiver
}
type MetricsReceiverShared ¶
type MetricsReceiverShared struct {
}
func (MetricsReceiverShared) CollectionIntervalString ¶
func (m MetricsReceiverShared) CollectionIntervalString() string
type MetricsReceiverSharedCluster ¶
type MetricsReceiverSharedCluster struct {
}
func (MetricsReceiverSharedCluster) ShouldCollectClusterMetrics ¶
func (m MetricsReceiverSharedCluster) ShouldCollectClusterMetrics() bool
type MetricsReceiverSharedCollectJVM ¶
type MetricsReceiverSharedCollectJVM struct {
}
func (MetricsReceiverSharedCollectJVM) ShouldCollectJVMMetrics ¶
func (m MetricsReceiverSharedCollectJVM) ShouldCollectJVMMetrics() bool
func (MetricsReceiverSharedCollectJVM) TargetSystemString ¶
func (m MetricsReceiverSharedCollectJVM) TargetSystemString(targetSystem string) string
type MetricsReceiverSharedJVM ¶
type MetricsReceiverSharedJVM struct {
}
func (MetricsReceiverSharedJVM) ConfigurePipelines ¶
func (m MetricsReceiverSharedJVM) ConfigurePipelines(targetSystem string, processors []otel.Component) ([]otel.ReceiverPipeline, error)
ConfigurePipelines sets up a Receiver using the MetricsReceiverSharedJVM and the targetSystem. This is used alongside the passed in processors to return a single Pipeline in an array.
func (MetricsReceiverSharedJVM) WithDefaultAdditionalJars ¶
func (m MetricsReceiverSharedJVM) WithDefaultAdditionalJars(defaultAdditionalJars ...string) MetricsReceiverSharedJVM
WithDefaultAdditionalJars overrides the MetricReceiverSharedJVM's AdditionalJars if it is empty. It then returns a new MetricReceiverSharedJVM with this change.
func (MetricsReceiverSharedJVM) WithDefaultEndpoint ¶
func (m MetricsReceiverSharedJVM) WithDefaultEndpoint(defaultEndpoint string) MetricsReceiverSharedJVM
WithDefaultEndpoint overrides the MetricReceiverSharedJVM's Endpoint if it is empty. It then returns a new MetricReceiverSharedJVM with this change.
type MetricsReceiverSharedTLS ¶
type MetricsReceiverSharedTLS struct {
}
func (MetricsReceiverSharedTLS) TLSConfig ¶
func (m MetricsReceiverSharedTLS) TLSConfig(defaultInsecure bool) map[string]interface{}
type MetricsService ¶
type ModifyField ¶
type ModifyField struct {
// Source of value for this field
MoveFrom string `yaml:"move_from" validate:"omitempty,field,excluded_with=CopyFrom StaticValue"`
CopyFrom string `yaml:"copy_from" validate:"omitempty,field,excluded_with=MoveFrom StaticValue"`
StaticValue *string `yaml:"static_value" validate:"excluded_with=MoveFrom CopyFrom DefaultValue"`
DefaultValue *string `yaml:"default_value" validate:"excluded_with=StaticValue"`
// Operations to perform
Type string `yaml:"type" validate:"omitempty,oneof=integer float"`
CustomConvertFunc func(ottl.LValue) ottl.Statements `yaml:"-"`
OmitIf string `yaml:"omit_if" validate:"omitempty,filter"`
MapValues map[string]string `yaml:"map_values"`
// In case the source field's value does not match any keys specified in the map_values pairs,
// the destination field will be forcefully unset if map_values_exclusive is true,
// or left untouched if map_values_exclusive is false.
MapValuesExclusive bool `yaml:"map_values_exclusive" validate:"excluded_without=MapValues"`
// contains filtered or unexported fields
}
type MultilineRule ¶
type MultilineRule = fluentbit.MultilineRule
type OTelProcessor ¶
type OTelProcessor interface {
Component
InternalOTelProcessor
}
type OTelReceiver ¶
type OTelReceiver interface {
Component
InternalOTelReceiver
}
type ParseMultiline ¶
type ParseMultiline struct {
ConfigComponent `yaml:",inline"`
// Make this a list so that it's forward compatible to support more `parse_multiline` type other than the build-in language exceptions.
MultilineGroups []*ParseMultilineGroup `yaml:"match_any" validate:"required,min=1,max=3,unique"`
}
func (ParseMultiline) CombinedRules ¶
func (p ParseMultiline) CombinedRules() []MultilineRule
func (ParseMultiline) Components ¶
func (ParseMultiline) Type ¶
func (r ParseMultiline) Type() string
type ParseMultilineGroup ¶
type ParseMultilineGroup struct {
Type string `yaml:"type" validate:"required,oneof=language_exceptions"`
Language string `yaml:"language" validate:"required,oneof=java python go"`
}
TODO: Add a validation check that will allow only one unique language exceptions that focus in one specific language.
type ParserShared ¶
type ParserShared struct {
// Not exposed to users for now, but can be used by app receivers.
// Documented at https://docs.fluentbit.io/manual/v/1.3/parser
// According to docs, this is only supported with `ltsv`, `logfmt`, and `regex` parsers.
Types map[string]string `yaml:"-" validate:"dive,oneof=string integer bool float hex"`
}
ParserShared holds common parameters that are used by all processors that are implemented with fluentbit's "parser" filter.
func (ParserShared) Component ¶
func (p ParserShared) Component(tag, uid string) (fluentbit.Component, string)
func (ParserShared) FluentBitSpecialFieldsStatements ¶
func (p ParserShared) FluentBitSpecialFieldsStatements(ctx context.Context) ottl.Statements
Handle special fields documented at https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/configuration#special-fields
func (ParserShared) TimestampStatements ¶
func (p ParserShared) TimestampStatements() (ottl.Statements, error)
func (ParserShared) TypesStatements ¶
func (p ParserShared) TypesStatements() (ottl.Statements, error)
type PipelineInstance ¶
type PipelineInstance struct {
PID, RID string
PipelineType string
Receiver Component
Processors []struct {
ID string
Component
}
Backend pipelineBackend
}
func (PipelineInstance) FluentBitComponents ¶
func (p PipelineInstance) FluentBitComponents(ctx context.Context) (fbSource, error)
func (PipelineInstance) OTelComponents ¶
func (p PipelineInstance) OTelComponents(ctx context.Context) (map[string]otel.ReceiverPipeline, map[string]otel.Pipeline, error)
func (*PipelineInstance) Types ¶
func (pi *PipelineInstance) Types() (string, string)
type PrometheusMetrics ¶
type PrometheusMetrics struct {
ConfigComponent `yaml:",inline"`
// Note that since we use the OTel Prometheus receiver, there is a caveat in the regex
// capture group syntax. Since the collector configuration supports env variable substitution
// `$` characters in your prometheus configuration are interpreted as environment
// variables. If you want to use $ characters in your prometheus configuration,
// you must escape them using `$$`.
PromConfig promconfig.Config `yaml:"config"`
}
func (PrometheusMetrics) AllowCustomProcessors ¶
func (r PrometheusMetrics) AllowCustomProcessors() bool
func (PrometheusMetrics) ExtractFeatures ¶
func (r PrometheusMetrics) ExtractFeatures() ([]CustomFeature, error)
ExtractFeatures returns a list of features that are enabled in the receiver config. Must always be a subset of ListAllFeatures().
func (PrometheusMetrics) ListAllFeatures ¶
func (r PrometheusMetrics) ListAllFeatures() []string
ListAllFeatures returns a list of all features that the receiver supports that we track.
func (PrometheusMetrics) Pipelines ¶
func (r PrometheusMetrics) Pipelines(ctx context.Context) ([]otel.ReceiverPipeline, error)
func (PrometheusMetrics) Type ¶
func (r PrometheusMetrics) Type() string
type RegexParser ¶
type RegexParser struct {
Regex string
Parser ParserShared
}
type Traces ¶
type Traces struct {
Service *TracesService `yaml:"service"`
}
type TracesReceiver ¶
type TracesReceiver interface {
// TODO: Distinguish from metrics somehow?
OTelReceiver
}
type TracesService ¶
type TrackingOverrideMapError ¶
type TrackingOverrideMapError struct {
FieldName string
}
func (*TrackingOverrideMapError) Error ¶
func (e *TrackingOverrideMapError) Error() string
type UnifiedConfig ¶
type UnifiedConfig struct {
Combined *Combined `yaml:"combined,omitempty"`
Logging *Logging `yaml:"logging"`
Metrics *Metrics `yaml:"metrics"`
// FIXME: OTel uses metrics/logs/traces but we appear to be using metrics/logging/traces
Traces *Traces `yaml:"traces,omitempty"`
Global *Global `yaml:"global,omitempty"`
}
Ops Agent config.
func MergeConfFiles ¶
func MergeConfFiles(ctx context.Context, userConfPath string, builtInConfStructs map[string]*UnifiedConfig) (*UnifiedConfig, error)
MergeConfFiles merges the user provided config with the built-in config struct for the platform.
func ReadUnifiedConfigFromFile ¶
func ReadUnifiedConfigFromFile(ctx context.Context, path string) (*UnifiedConfig, error)
ReadUnifiedConfigFromFile reads the user config file and returns a UnifiedConfig. If the user config file does not exist, it returns nil.
func UnmarshalYamlToUnifiedConfig ¶
func UnmarshalYamlToUnifiedConfig(ctx context.Context, input []byte) (*UnifiedConfig, error)
func (*UnifiedConfig) DeepCopy ¶
func (uc *UnifiedConfig) DeepCopy(ctx context.Context) (*UnifiedConfig, error)
func (*UnifiedConfig) GenerateFilesFromConfig ¶
func (uc *UnifiedConfig) GenerateFilesFromConfig(ctx context.Context, service, logsDir, stateDir, outDir string) error
func (*UnifiedConfig) GenerateFluentBitConfigs ¶
func (uc *UnifiedConfig) GenerateFluentBitConfigs(ctx context.Context, logsDir string, stateDir string) (map[string]string, error)
GenerateFluentBitConfigs generates configuration file(s) for Fluent Bit. It returns a map of filenames to file contents.
func (*UnifiedConfig) GenerateOtelConfig ¶
func (*UnifiedConfig) HasCombined ¶
func (uc *UnifiedConfig) HasCombined() bool
func (*UnifiedConfig) HasLogging ¶
func (uc *UnifiedConfig) HasLogging() bool
func (*UnifiedConfig) HasMetrics ¶
func (uc *UnifiedConfig) HasMetrics() bool
func (*UnifiedConfig) LoggingReceivers ¶
LoggingReceivers returns a map of potential logging receivers. Each Component may or may not be usable in fluent-bit or otel.
func (*UnifiedConfig) MetricsReceivers ¶
func (uc *UnifiedConfig) MetricsReceivers() (map[string]MetricsReceiver, error)
func (*UnifiedConfig) OTelLoggingReceivers ¶
func (uc *UnifiedConfig) OTelLoggingReceivers(ctx context.Context) (map[string]OTelReceiver, error)
func (*UnifiedConfig) OTelLoggingSupported ¶
func (uc *UnifiedConfig) OTelLoggingSupported(ctx context.Context) bool
func (*UnifiedConfig) Pipelines ¶
func (uc *UnifiedConfig) Pipelines(ctx context.Context) ([]PipelineInstance, error)
func (*UnifiedConfig) String ¶
func (uc *UnifiedConfig) String() string
func (*UnifiedConfig) TracesReceivers ¶
func (uc *UnifiedConfig) TracesReceivers() (map[string]TracesReceiver, error)
func (*UnifiedConfig) ValidateCombined ¶
func (uc *UnifiedConfig) ValidateCombined() error
func (*UnifiedConfig) ValidateLogging ¶
func (uc *UnifiedConfig) ValidateLogging() error
func (*UnifiedConfig) ValidateMetrics ¶
func (uc *UnifiedConfig) ValidateMetrics(ctx context.Context) error
func (*UnifiedConfig) ValidateTraces ¶
func (uc *UnifiedConfig) ValidateTraces() error
type VersionedReceivers ¶
type VersionedReceivers struct {
ReceiverVersion string `yaml:"receiver_version,omitempty" tracking:""`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fluentbit provides data structures to represent and generate fluentBit configuration.
|
Package fluentbit provides data structures to represent and generate fluentBit configuration. |
|
modify
Package modify provides helpers for generating fluentbit configs
|
Package modify provides helpers for generating fluentbit configs |
|
Package otel provides data structures to represent and generate otel configuration.
|
Package otel provides data structures to represent and generate otel configuration. |