Starting filebeat on windows as a service does not expand env vars in config file

Beat version: filebeat:5.6.2
Operating System: Microsoft Windows Server 2012 R2 Standard on ec2

Hi there,

I'm starting filebeat as a service on windows by running Start-Service filebeat at the end of a powershell script, but the issue is that environment variable expansion in filebeat.yml isn't working. I confirmed by explicitly setting a variable the line before starting the service ($env:sysinfo = "testing").

After investigation: "The service control manager does not support passing custom environment variables to a service at startup."

I also investigated passing the -E var=${val} flags to the service on start, but haven't been successful.

$fb = New-Object System.ServiceProcess.ServiceController("filebeat", $env:COMPUTERNAME)
$env_args = @("-E sysinfo=${testing}")
$fb.Start($env_args)

Is there any other way to get environment variables to expand short of modifying the bundled installation script to include the E flags?

Here's one example in my config file of this. The sysinfo field in the logstash output is always the default when the events come from fb on windows (the expansion is working correctly from fb on linux):

fields_under_root: true
fields:
sysinfo: ${sysinfo:nil}

Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.