diff --git a/build/windows/installer/livenessprobe/livenessprobe.cpp b/build/windows/installer/livenessprobe/livenessprobe.cpp index ca2083e3a..86dbd8561 100644 --- a/build/windows/installer/livenessprobe/livenessprobe.cpp +++ b/build/windows/installer/livenessprobe/livenessprobe.cpp @@ -113,7 +113,7 @@ int _tmain(int argc, wchar_t *argv[]) wprintf_s(L"ERROR:Process:%s is not running\n", argv[1]); return NO_FLUENT_BIT_PROCESS; } - const DWORD bufferSize = 256; + const DWORD bufferSize = 16; wchar_t enableCustomMetricsValue[bufferSize]; wchar_t msiModeValue[bufferSize]; GetEnvironmentVariable(L"ENABLE_CUSTOM_METRICS", enableCustomMetricsValue, bufferSize); diff --git a/kubernetes/windows/main.ps1 b/kubernetes/windows/main.ps1 index dafdfaf32..f6b72018d 100644 --- a/kubernetes/windows/main.ps1 +++ b/kubernetes/windows/main.ps1 @@ -725,13 +725,13 @@ function Start-Fluent-Telegraf { } $enableCustomMetrics = [System.Environment]::GetEnvironmentVariable("ENABLE_CUSTOM_METRICS", "process") - if ($enableCustomMetrics.ToLower() -eq 'true') { + if (![string]::IsNullOrEmpty($enableCustomMetrics) -and $enableCustomMetrics.ToLower() -eq 'true') { Move-Item -Path "C:/etc/fluent/fluent-cm.conf" -Destination "C:/etc/fluent/fluent.conf" -Force } $isAADMSIAuth = [System.Environment]::GetEnvironmentVariable("USING_AAD_MSI_AUTH") # Start fluentd as a windows service only if custom metrics is enabled or legacy mode - if ($enableCustomMetrics.ToLower() -eq 'true' -or [string]::IsNullOrEmpty($isAADMSIAuth) -or $isAADMSIAuth.ToLower() -eq "false") { + if ((![string]::IsNullOrEmpty($enableCustomMetrics) -and $enableCustomMetrics.ToLower() -eq 'true') -or [string]::IsNullOrEmpty($isAADMSIAuth) -or $isAADMSIAuth.ToLower() -eq "false") { fluentd --reg-winsvc i --reg-winsvc-auto-start --winsvc-name fluentdwinaks --reg-winsvc-fluentdopt '-c C:/etc/fluent/fluent.conf -o C:/etc/fluent/fluent.log' }