Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.5](backport #33697) Fix error spam on AKS #33702

Merged
merged 1 commit into from
Nov 17, 2022
Merged
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
29 changes: 1 addition & 28 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ https://github.com/elastic/beats/compare/v8.2.0\...main[Check the HEAD diff]

*Filebeat*

- Fixed error spam from `add_kubernetes_metadata` processor when running on AKS. {pull}33697[33697]

*Heartbeat*

Expand Down Expand Up @@ -134,31 +135,3 @@ https://github.com/elastic/beats/compare/v8.2.0\...main[Check the HEAD diff]
*Functionbeat*

==== Known Issue




























6 changes: 3 additions & 3 deletions filebeat/processor/add_kubernetes_metadata/matchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func newLogsPathMatcher(cfg conf.C) (add_kubernetes_metadata.Matcher, error) {

err := cfg.Unpack(&config)
if err != nil || config.LogsPath == "" {
return nil, fmt.Errorf("fail to unpack the `logs_path` configuration: %s", err)
return nil, fmt.Errorf("fail to unpack the `logs_path` configuration: %w", err)
}

logPath := config.LogsPath
Expand Down Expand Up @@ -92,7 +92,7 @@ func (f *LogPathMatcher) MetadataIndex(event mapstr.M) string {
f.logger.Debugf("Incoming log.file.path value: %s", source)

if !strings.Contains(source, f.LogsPath) {
f.logger.Errorf("Error extracting container id - source value does not contain matcher's logs_path '%s'.", f.LogsPath)
f.logger.Debugf("log.file.path value does not contain matcher's logs_path '%s', skipping...", f.LogsPath)
return ""
}

Expand All @@ -102,7 +102,7 @@ func (f *LogPathMatcher) MetadataIndex(event mapstr.M) string {
if f.ResourceType == "pod" {
// Pod resource type will extract only the pod UID, which offers less granularity of metadata when compared to the container ID
if strings.Contains(source, ".log") && !strings.HasSuffix(source, ".gz") {
// Specify a pod resource type when writting logs into manually mounted log volume,
// Specify a pod resource type when writing logs into manually mounted log volume,
// those logs apper under under "/var/lib/kubelet/pods/<pod_id>/volumes/..."
if strings.HasPrefix(f.LogsPath, podKubeletLogsPath()) {
pathDirs := strings.Split(source, pathSeparator)
Expand Down