diff --git a/controllers/libs/logging/logging.go b/controllers/libs/logging/logging.go index 2a47eae..092b276 100644 --- a/controllers/libs/logging/logging.go +++ b/controllers/libs/logging/logging.go @@ -57,7 +57,7 @@ func CreateForwarderEnvVars(name string, extraLabels []FluentBitLabel) []apiv1.E return forwarderEnvVars } -func CreateBaseLoggingExtraKeys(name string, component string) []FluentBitLabel { +func CreateBaseLoggingExtraKeys(name string, component string, container string, namespace string) []FluentBitLabel { baseExtraKeys := []FluentBitLabel{ { Key: "labels_app", @@ -71,6 +71,14 @@ func CreateBaseLoggingExtraKeys(name string, component string) []FluentBitLabel Key: "component", Value: component, }, + { + Key: "namespace", + Value: namespace, + }, + { + Key: "container", + Value: container, + }, } return baseExtraKeys } diff --git a/controllers/nodepool.go b/controllers/nodepool.go index bbb8d79..86c8683 100644 --- a/controllers/nodepool.go +++ b/controllers/nodepool.go @@ -194,7 +194,7 @@ func (r *SFController) mkLoggingTemplate(serviceName string) (string, error) { } var loggingParams = logging.CreateForwarderConfigTemplateParams("nodepool."+serviceName, r.cr.Spec.FluentBitLogForwarding) - var loggingExtraKeys = logging.CreateBaseLoggingExtraKeys("nodepool-"+serviceName, "nodepool") + var loggingExtraKeys = logging.CreateBaseLoggingExtraKeys("nodepool-"+serviceName, "nodepool", serviceName, r.ns) // Change logLevel to what we actually want loggingParams.LogLevel = string(selectedLogLevel) diff --git a/controllers/zuul.go b/controllers/zuul.go index a6d7809..34266f8 100644 --- a/controllers/zuul.go +++ b/controllers/zuul.go @@ -397,7 +397,7 @@ func (r *SFController) computeLoggingConfig() map[string]string { } var zeloggingParams = logging.CreateForwarderConfigTemplateParams("zuul.executor", r.cr.Spec.FluentBitLogForwarding) - var zeloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-executor", "zuul") + var zeloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-executor", "zuul", "zuul-executor", r.ns) // Change logLevel to what we actually want zeloggingParams.LogLevel = string(zuulExecutorLogLevel) loggingData["zuul-executor-logging.yaml"], _ = utils.ParseString( @@ -408,7 +408,7 @@ func (r *SFController) computeLoggingConfig() map[string]string { }{zeloggingExtraKeys, zeloggingParams}) var zsloggingParams = logging.CreateForwarderConfigTemplateParams("zuul.scheduler", r.cr.Spec.FluentBitLogForwarding) - var zsloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-scheduler", "zuul") + var zsloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-scheduler", "zuul", "zuul-scheduler", r.ns) // Change logLevel to what we actually want zsloggingParams.LogLevel = string(zuulSchedulerLogLevel) loggingData["zuul-scheduler-logging.yaml"], _ = utils.ParseString( @@ -419,7 +419,7 @@ func (r *SFController) computeLoggingConfig() map[string]string { }{zsloggingExtraKeys, zsloggingParams}) var zwloggingParams = logging.CreateForwarderConfigTemplateParams("zuul.web", r.cr.Spec.FluentBitLogForwarding) - var zwloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-web", "zuul") + var zwloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-web", "zuul", "zuul-web", r.ns) // Change logLevel to what we actually want zwloggingParams.LogLevel = string(zuulWebLogLevel) loggingData["zuul-web-logging.yaml"], _ = utils.ParseString( @@ -430,7 +430,7 @@ func (r *SFController) computeLoggingConfig() map[string]string { }{zwloggingExtraKeys, zwloggingParams}) var zmloggingParams = logging.CreateForwarderConfigTemplateParams("zuul.merger", r.cr.Spec.FluentBitLogForwarding) - var zmloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-merger", "zuul") + var zmloggingExtraKeys = logging.CreateBaseLoggingExtraKeys("zuul-merger", "zuul", "zuul-merger", r.ns) // Change logLevel to what we actually want zmloggingParams.LogLevel = string(zuulMergerLogLevel) loggingData["zuul-merger-logging.yaml"], _ = utils.ParseString( diff --git a/doc/deployment/logging.md b/doc/deployment/logging.md index fd64cdf..241af1f 100644 --- a/doc/deployment/logging.md +++ b/doc/deployment/logging.md @@ -68,10 +68,10 @@ The log JSON payload that is sent to your Fluent Bit collector is enriched with |--------|------------------| | labels_run | the "run" label in the pod's metadata; ie the name of the microservice emitting the log line | | labels_app | the "app" label, it is always set to "sf" | -| podip | the IP address of the pod | +| podip | [DEPRECATED] the IP address of the pod | | namespace | the namespace where the pod is running | -| nodename | the node where the pod is running | -| podname | the name of the pod where the service is running | +| nodename | [DEPRECATED] the node where the pod is running | +| podname | [DEPRECATED] the name of the pod where the service is running | | log | the actual log line collected | | component | the name of the component running the microservice; typically "zuul" or "nodepool" | | container | the name of the container emitting the logs | diff --git a/doc/reference/CHANGELOG.md b/doc/reference/CHANGELOG.md index 5338595..5a7a9c0 100644 --- a/doc/reference/CHANGELOG.md +++ b/doc/reference/CHANGELOG.md @@ -7,13 +7,28 @@ All notable changes to this project will be documented in this file. ### Added ### Removed ### Changed +### Fixed +### Security + +## [v0.0.44] - 2024-10-08 + +### Added - log forwarding - Added support for the [forward input](https://docs.fluentbit.io/manual/pipeline/inputs/forward). - The HTTP input is deprecated and support for it will be removed at a later point. +- log forwarding - improved fluent bit sidecar containers' resilience to OOM killing and backpressure issues. + +### Removed +### Changed + + +- log forwarding - The HTTP input is **deprecated** and support for it will be removed at a later point. +- log forwarding - The predefined labels `podip`, `nodename` and `podname` are **deprecated**. + They are not supported in the Forward input for the Zuul and Nodepool components, and will + be removed for all components at a later point. ### Fixed -SF bootstrap-tenant command - fix the base pre-run playbook for container based job (wrong condition check) +- SF bootstrap-tenant command - fix the base pre-run playbook for container based job (wrong condition check) ### Security