From 108f77b32a64697a2f86640371e6526c0021cc5e Mon Sep 17 00:00:00 2001 From: longwan Date: Thu, 12 Sep 2024 19:17:14 +0000 Subject: [PATCH 1/2] fix windows fluent-bit feature to use resource optimization flag --- build/common/installer/scripts/fluent-bit-conf-customizer.rb | 3 ++- kubernetes/linux/main.sh | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/common/installer/scripts/fluent-bit-conf-customizer.rb b/build/common/installer/scripts/fluent-bit-conf-customizer.rb index 6b937f2e7..7884726a4 100644 --- a/build/common/installer/scripts/fluent-bit-conf-customizer.rb +++ b/build/common/installer/scripts/fluent-bit-conf-customizer.rb @@ -132,7 +132,8 @@ def substituteFluentBitPlaceHolders stacktraceLanguages = ENV["AZMON_MULTILINE_LANGUAGES"] resourceOptimizationEnabled = ENV["AZMON_RESOURCE_OPTIMIZATION_ENABLED"] enableCustomMetrics = ENV["ENABLE_CUSTOM_METRICS"] - windowsFluentBitDisabled = ENV["AZMON_WINDOWS_FLUENT_BIT_DISABLED"] + # windowsFluentBitDisabled = ENV["AZMON_WINDOWS_FLUENT_BIT_DISABLED"] + windowsFluentBitDisabled = !resourceOptimizationEnabled kubernetesMetadataCollection = ENV["AZMON_KUBERNETES_METADATA_ENABLED"] annotationBasedLogFiltering = ENV["AZMON_ANNOTATION_BASED_LOG_FILTERING"] storageMaxChunksUp = ENV["FBIT_STORAGE_MAX_CHUNKS_UP"] diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index 062257faf..2d53ae7bf 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -1060,9 +1060,10 @@ if [ ! -f /etc/cron.d/ci-agent ]; then echo "*/5 * * * * root /usr/sbin/logrotate -s /var/lib/logrotate/ci-agent-status /etc/logrotate.d/ci-agent >/dev/null 2>&1" >/etc/cron.d/ci-agent fi -setGlobalEnvVar AZMON_WINDOWS_FLUENT_BIT_DISABLED "${AZMON_WINDOWS_FLUENT_BIT_DISABLED}" +# setGlobalEnvVar AZMON_WINDOWS_FLUENT_BIT_DISABLED "${AZMON_WINDOWS_FLUENT_BIT_DISABLED}" +setGlobalEnvVar AZMON_WINDOWS_FLUENT_BIT_DISABLED "$( [ "${AZMON_RESOURCE_OPTIMIZATION_ENABLED}" == "true" ] && echo "false" || echo "true" )" if [ "${AZMON_WINDOWS_FLUENT_BIT_DISABLED}" == "true" ] || [ -z "${AZMON_WINDOWS_FLUENT_BIT_DISABLED}" ] || [ "${USING_AAD_MSI_AUTH}" != "true" ] || [ "${RS_GENEVA_LOGS_INTEGRATION}" == "true" ]; then - if [ -e "/etc/config/kube.conf" ]; then + if [ -e "/etc/fluent/kube.conf" ]; then # Replace a string in the configmap file sed -i "s/#@include windows_rs/@include windows_rs/g" /etc/fluent/kube.conf sed -i "s/#@include windows_rs/@include windows_rs/g" /etc/fluent/kube-cm.conf From 7f7d687671c5d6c266f44a44130c44d68658597e Mon Sep 17 00:00:00 2001 From: longwan Date: Thu, 12 Sep 2024 23:36:28 +0000 Subject: [PATCH 2/2] remove commented out line and revert check for RS --- build/common/installer/scripts/fluent-bit-conf-customizer.rb | 1 - kubernetes/linux/main.sh | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/build/common/installer/scripts/fluent-bit-conf-customizer.rb b/build/common/installer/scripts/fluent-bit-conf-customizer.rb index 7884726a4..ee821d09c 100644 --- a/build/common/installer/scripts/fluent-bit-conf-customizer.rb +++ b/build/common/installer/scripts/fluent-bit-conf-customizer.rb @@ -132,7 +132,6 @@ def substituteFluentBitPlaceHolders stacktraceLanguages = ENV["AZMON_MULTILINE_LANGUAGES"] resourceOptimizationEnabled = ENV["AZMON_RESOURCE_OPTIMIZATION_ENABLED"] enableCustomMetrics = ENV["ENABLE_CUSTOM_METRICS"] - # windowsFluentBitDisabled = ENV["AZMON_WINDOWS_FLUENT_BIT_DISABLED"] windowsFluentBitDisabled = !resourceOptimizationEnabled kubernetesMetadataCollection = ENV["AZMON_KUBERNETES_METADATA_ENABLED"] annotationBasedLogFiltering = ENV["AZMON_ANNOTATION_BASED_LOG_FILTERING"] diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index 2d53ae7bf..036812a16 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -1060,10 +1060,9 @@ if [ ! -f /etc/cron.d/ci-agent ]; then echo "*/5 * * * * root /usr/sbin/logrotate -s /var/lib/logrotate/ci-agent-status /etc/logrotate.d/ci-agent >/dev/null 2>&1" >/etc/cron.d/ci-agent fi -# setGlobalEnvVar AZMON_WINDOWS_FLUENT_BIT_DISABLED "${AZMON_WINDOWS_FLUENT_BIT_DISABLED}" setGlobalEnvVar AZMON_WINDOWS_FLUENT_BIT_DISABLED "$( [ "${AZMON_RESOURCE_OPTIMIZATION_ENABLED}" == "true" ] && echo "false" || echo "true" )" if [ "${AZMON_WINDOWS_FLUENT_BIT_DISABLED}" == "true" ] || [ -z "${AZMON_WINDOWS_FLUENT_BIT_DISABLED}" ] || [ "${USING_AAD_MSI_AUTH}" != "true" ] || [ "${RS_GENEVA_LOGS_INTEGRATION}" == "true" ]; then - if [ -e "/etc/fluent/kube.conf" ]; then + if [ -e "/etc/config/kube.conf" ]; then # Replace a string in the configmap file sed -i "s/#@include windows_rs/@include windows_rs/g" /etc/fluent/kube.conf sed -i "s/#@include windows_rs/@include windows_rs/g" /etc/fluent/kube-cm.conf