Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mikusvis opened this issue Sep 12, 2023 · 1 comment · Fixed by #589
Labels
bug Something isn't working
Milestone

Comments

@mikusvis
Copy link

mikusvis commented Sep 12, 2023

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)
@ashie ashie added the bug Something isn't working label Sep 13, 2023
@ashie ashie added this to the 5.0.2 (T.B.D) milestone Sep 13, 2023
@daipom
Copy link
Contributor

daipom commented Sep 13, 2023

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 ...

@kenhys kenhys moved this to LTS WIP in Fluentd Kanban Sep 13, 2023
@daipom daipom linked a pull request Sep 25, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this from LTS WIP to Done in Fluentd Kanban Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants