Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions confgenerator/logging_receivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ type LoggingReceiverFiles struct {
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"`
// FileCacheAdvise controls fluent-bit's file_cache_advise option (Linux only).
// When true (fluent-bit's default), uses POSIX_FADV_DONTNEED to reduce kernel file cache usage.
// Set to false to keep files in cache, reducing disk I/O in scenarios with multiple pipelines or high re-read patterns.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamessmithafc1886-byte Is the comment missing? :)

FileCacheAdvise *bool `yaml:"file_cache_advise,omitempty"`
}

func (r LoggingReceiverFiles) Type() string {
Expand All @@ -56,6 +60,7 @@ func (r LoggingReceiverFiles) mixin() LoggingReceiverFilesMixin {
ExcludePaths: r.ExcludePaths,
WildcardRefreshInterval: r.WildcardRefreshInterval,
RecordLogFilePath: r.RecordLogFilePath,
FileCacheAdvise: r.FileCacheAdvise,
}
}

Expand All @@ -78,6 +83,7 @@ type LoggingReceiverFilesMixin struct {
MultilineRules []MultilineRule `yaml:"-"`
BufferInMemory bool `yaml:"-"`
RecordLogFilePath *bool `yaml:"record_log_file_path,omitempty"`
FileCacheAdvise *bool `yaml:"file_cache_advise,omitempty"`
// In transformation test mode, the file is read exactly once from the beginning, and then the process exits.
TransformationTest bool `yaml:"-" tracking:"-"`
}
Expand Down Expand Up @@ -157,6 +163,14 @@ func (r LoggingReceiverFilesMixin) Components(ctx context.Context, tag string) [
config["Path_Key"] = "agent.googleapis.com/log_file_path"
}

if r.FileCacheAdvise != nil {
if *r.FileCacheAdvise {
config["file_cache_advise"] = "true"
} else {
config["file_cache_advise"] = "false"
}
}

if r.BufferInMemory {
config["storage.type"] = "memory"
}
Expand Down
4 changes: 4 additions & 0 deletions confgenerator/testdata/feature/golden.csv
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ App,Field,Override,
*confgenerator.LoggingProcessorParseJson,confgenerator.ConfigComponent.Type,
*confgenerator.LoggingProcessorParseRegex,PreserveKey,
*confgenerator.LoggingProcessorParseRegex,confgenerator.ConfigComponent.Type,
*confgenerator.LoggingReceiverFiles,FileCacheAdvise,
*confgenerator.LoggingReceiverFiles,RecordLogFilePath,
*confgenerator.LoggingReceiverFiles,WildcardRefreshInterval,
*confgenerator.LoggingReceiverFiles,confgenerator.ConfigComponent.Type,
Expand Down Expand Up @@ -203,14 +204,17 @@ App,Field,Override,
*confgenerator.loggingReceiverMacroAdapter[*github.com/GoogleCloudPlatform/ops-agent/confgenerator.loggingFilesProcessorMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingProcessorMacroZookeeperGeneral]],confgenerator.ConfigComponent.Type,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroActiveDirectoryDS],confgenerator.ConfigComponent.Type,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAlert],apps.LoggingReceiverMacroOracleDBAlert.confgenerator.LoggingReceiverFilesMixin.BufferInMemory,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAlert],apps.LoggingReceiverMacroOracleDBAlert.confgenerator.LoggingReceiverFilesMixin.FileCacheAdvise,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAlert],apps.LoggingReceiverMacroOracleDBAlert.confgenerator.LoggingReceiverFilesMixin.RecordLogFilePath,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAlert],apps.LoggingReceiverMacroOracleDBAlert.confgenerator.LoggingReceiverFilesMixin.WildcardRefreshInterval,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAlert],confgenerator.ConfigComponent.Type,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAudit],apps.LoggingReceiverMacroOracleDBAudit.confgenerator.LoggingReceiverFilesMixin.BufferInMemory,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAudit],apps.LoggingReceiverMacroOracleDBAudit.confgenerator.LoggingReceiverFilesMixin.FileCacheAdvise,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAudit],apps.LoggingReceiverMacroOracleDBAudit.confgenerator.LoggingReceiverFilesMixin.RecordLogFilePath,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAudit],apps.LoggingReceiverMacroOracleDBAudit.confgenerator.LoggingReceiverFilesMixin.WildcardRefreshInterval,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroOracleDBAudit],confgenerator.ConfigComponent.Type,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroVaultAuditJson],apps.LoggingReceiverMacroVaultAuditJson.confgenerator.LoggingReceiverFilesMixin.BufferInMemory,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroVaultAuditJson],apps.LoggingReceiverMacroVaultAuditJson.confgenerator.LoggingReceiverFilesMixin.FileCacheAdvise,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroVaultAuditJson],apps.LoggingReceiverMacroVaultAuditJson.confgenerator.LoggingReceiverFilesMixin.RecordLogFilePath,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroVaultAuditJson],apps.LoggingReceiverMacroVaultAuditJson.confgenerator.LoggingReceiverFilesMixin.WildcardRefreshInterval,
*confgenerator.loggingReceiverMacroAdapter[github.com/GoogleCloudPlatform/ops-agent/apps.LoggingReceiverMacroVaultAuditJson],confgenerator.ConfigComponent.Type,