fluent / fluent-package-builder

td-agent (Fluentd) Building and Packaging System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

td-agent not starting as Windows service if installed in directory containing spaces, e.g. "Program Files"

mikusvis opened this issue · comments

Describe the bug

When td-agent is installed on a path containing spaces, e.g. C:\Program Files (x86)\td-agent, Windows service is started normally and remains in status "Running"
But td-agent is actually not started and is not running, td-agent-0.log is not created etc.

The issue is incorrectly escaped values in Windows Registry entry Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fluentdwinsvc\fluentdopt.
Actual value is:
-c C:\Program Files (x86)\td-agent\etc\td-agent\td-agent.conf -o C:\Program Files (x86)\td-agent\td-agent.log
while path should be properly escaped
-c "C:\Program Files (x86)\td-agent\etc\td-agent\td-agent.conf" -o "C:\Program Files (x86)\td-agent\td-agent.log"

Possible fix might be to add third layer of escapes with quotes in https://github.com/fluent/fluent-package-builder/blob/master/fluent-package/msi/source.wxs#L188. There parameter for "--reg-winsvc-fluentdopt" is already escaped with ", but still additional escaping is necessary for FLUENTPROJECTLOCATION

To Reproduce

Install td-agent on Windows using defaults, but change default location to C:\Program Files (x86)\

Expected behavior

After installation Fluentd Windows Service is running.
And Task Manager shows multiple running processes located in C:\Program Files (x86)\td-agent\bin\ruby.exe.

Actual behavior

After installation Fluentd Windows Service is running.
But Task Manager shows no running processes located in C:\Program Files (x86)\td-agent\bin\ruby.exe.

Workarounds

  1. Manually change registry value Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fluentdwinsvc\fluentdopt
  2. Start fluentd manually from cmd , not as service service
  3. Install using default path C:\opt (if company policies allow it)

Thanks for your report.
Certainly, the current logic doesn't support the paths with whitespaces.
This doesn't seem to be intended.
We should fix it.

Workarounds

1. Manually change registry value  `Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\fluentdwinsvc\fluentdopt`

We can overwrite the command-line option by --reg-winsvc-fluentdopt option.

(Fluent Package Command Prompt with administrative privileges)

$ fluentd --reg-winsvc-fluentdopt ...