Skip to content

Commit 6fc9f09

Browse files
Fix geneva resource optimization (#1447)
* fix geneva bug in resource optimization path * Add resource optimization for geneva path * Add resource optimization for geneva path * Add resource optimization for geneva path * Add resource optimization for geneva path * update using right file name --------- Co-authored-by: Ganga Mahesh Siddem <[email protected]>
1 parent 3268cb2 commit 6fc9f09

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

build/common/installer/scripts/fluent-bit-conf-customizer.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
@using_aad_msi_auth = true
1818
end
1919

20-
@geneva_logs_integration = false
21-
if !ENV["GENEVA_LOGS_INTEGRATION"].nil? && !ENV["GENEVA_LOGS_INTEGRATION"].empty? && ENV["GENEVA_LOGS_INTEGRATION"].strip.casecmp("true") == 0
22-
@geneva_logs_integration = true
23-
end
24-
25-
2620
@default_service_interval = "15"
2721
@default_mem_buf_limit = "10"
2822
@default_high_log_scale_service_interval = "1"
@@ -70,8 +64,8 @@ def substituteStorageTotalLimitSize(new_contents)
7064
end
7165

7266
def substituteResourceOptimization(resourceOptimizationEnabled, new_contents)
73-
#Update the config file only in two conditions: 1. Linux and resource optimization is enabled 2. Windows and using aad msi auth and not using geneva logs integration
74-
if (!@isWindows && !resourceOptimizationEnabled.nil? && resourceOptimizationEnabled.to_s.downcase == "true") || (@isWindows && @using_aad_msi_auth && !@geneva_logs_integration)
67+
#Update the config file for two scnenarios for non-geneva mode: 1. Linux and resource optimization is enabled 2. Windows and using aad msi auth
68+
if (!@isWindows && !resourceOptimizationEnabled.nil? && resourceOptimizationEnabled.to_s.downcase == "true") || (@isWindows && @using_aad_msi_auth)
7569
puts "config::Starting to substitute the placeholders in fluent-bit.conf file for resource optimization"
7670
if (@isWindows)
7771
new_contents = new_contents.gsub("#${ResourceOptimizationPluginFile}", "plugins_file /etc/fluent-bit/azm-containers-input-plugins.conf")

build/common/installer/scripts/fluent-bit-geneva-conf-customizer.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ def is_valid_number?(value)
3030
return !value.nil? && is_number?(value) && value.to_i > 0
3131
end
3232

33+
#Update the config file for geneva mode linux and resource optimization enabled
34+
def substituteResourceOptimization(resourceOptimizationEnabled, new_contents, isWindows)
35+
if !isWindows && !resourceOptimizationEnabled.nil? && resourceOptimizationEnabled.to_s.downcase == "true"
36+
puts "config::Starting to substitute the placeholders in fluent-bit-geneva conf file for resource optimization"
37+
new_contents = new_contents.gsub("#${ResourceOptimizationPluginFile}", "plugins_file /etc/opt/microsoft/docker-cimprov/azm-containers-input-plugins.conf")
38+
new_contents = new_contents.gsub("#${ResourceOptimizationFBConfigFile}", "@INCLUDE fluent-bit-input.conf")
39+
end
40+
return new_contents
41+
end
42+
3343
def substituteFluentBitPlaceHolders(configFilePath)
3444
begin
3545
# Replace the fluentbit config file with custom values if present
@@ -46,6 +56,7 @@ def substituteFluentBitPlaceHolders(configFilePath)
4656
enableFluentBitThreading = ENV["ENABLE_FBIT_THREADING"]
4757
kubernetesMetadataCollection = ENV["AZMON_KUBERNETES_METADATA_ENABLED"]
4858
annotationBasedLogFiltering = ENV["AZMON_ANNOTATION_BASED_LOG_FILTERING"]
59+
resourceOptimizationEnabled = ENV["AZMON_RESOURCE_OPTIMIZATION_ENABLED"]
4960

5061
serviceInterval = is_valid_number?(interval) ? interval : @default_service_interval
5162
serviceIntervalSetting = "Flush " + serviceInterval
@@ -112,6 +123,8 @@ def substituteFluentBitPlaceHolders(configFilePath)
112123
end
113124
end
114125

126+
new_contents = substituteResourceOptimization(resourceOptimizationEnabled, new_contents, @isWindows)
127+
115128
File.open(configFilePath, "w") { |file| file.puts new_contents }
116129
puts "config::Successfully substituted the placeholders in #{configFileName} file"
117130
rescue => errorStr

build/linux/installer/conf/fluent-bit-geneva.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
Log_Level info
1313
Parsers_File /etc/opt/microsoft/docker-cimprov/azm-containers-parser.conf
1414
Log_File /var/opt/microsoft/docker-cimprov/log/fluent-bit-geneva.log
15+
#${ResourceOptimizationPluginFile}
16+
17+
#${ResourceOptimizationFBConfigFile}
1518

1619
#NOTE: Multiline should be the first filter https://docs.fluentbit.io/manual/pipeline/filters/multiline-stacktrace
1720
#${MultilineEnabled}[FILTER]

0 commit comments

Comments
 (0)