[windows] Fix default log file directory
By default, let the agent determine its log file directory.
Overrides still work
MODIFY
attributes/default.rb
attributes/default.rb
@@ -160,6 +160,7 @@ default['datadog']['windows_agent_use_exe'] = false
# Values that differ on Windows
# The location of the config folder (containing conf.d)
# The name of the dd agent service
+# The log file directory (see logging section below)
if node['platform_family'] == 'windows'
default['datadog']['config_dir'] = "#{ENV['ProgramData']}/Datadog"
default['datadog']['agent_name'] = 'DatadogAgent'
@@ -262,7 +263,12 @@ default['datadog']['syslog']['active'] = false
default['datadog']['syslog']['udp'] = false
default['datadog']['syslog']['host'] = nil
default['datadog']['syslog']['port'] = nil
-default['datadog']['log_file_directory'] = '/var/log/datadog'
+default['datadog']['log_file_directory'] =
+ if node['platform_family'] == 'windows'
+ nil # let the agent use a default log file dir
+ else
+ '/var/log/datadog'
+ end
# Web proxy configuration
default['datadog']['web_proxy']['host'] = nil

MODIFY
templates/default/datadog.conf.erb
templates/default/datadog.conf.erb
@@ -125,6 +125,7 @@ use_dogstatsd: no
log_level: <%= node['datadog']['log_level'] %>
+<% if node['datadog']['log_file_directory'] -%>
collector_log_file: <%= node['datadog']['log_file_directory'] %>/collector.log
forwarder_log_file: <%= node['datadog']['log_file_directory'] %>/forwarder.log
dogstatsd_log_file: <%= node['datadog']['log_file_directory'] %>/dogstatsd.log
@@ -132,6 +133,7 @@ jmxfetch_log_file: <%= node['datadog']['log_file_directory'] %>/jmxfetch.log
<% unless node['platform_family'] == 'windows' -%>
go-metro_log_file: <%= node['datadog']['log_file_directory'] %>/go-metro.log
<% end -%>
+<% end -%>
# if syslog is enabled but a host and port are not set, a local domain socket
# connection will be attempted

[windows] Fix default log file directory (#492)

By default, let the agent determine its log file directory.

Overrides still work