diff --git a/attributes/default.rb b/attributes/default.rb index 10e3402..962125e 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -47,4 +47,9 @@ default['consul']['wan']['enabled'] = "false" default['consul']['wan']['serf_port'] = "8302" -default['consul']['wan']['nodes'] = nil \ No newline at end of file +default['consul']['wan']['nodes'] = nil + +# 7 days +default['consul']['log_rotate_max_files'] = "7" +# 300mb +default['consul']['log_rotate_bytes'] = "314572800" \ No newline at end of file diff --git a/metadata.rb b/metadata.rb index 1996d6a..0c85c68 100644 --- a/metadata.rb +++ b/metadata.rb @@ -123,3 +123,11 @@ attribute "consul/metrics/prometheus_retention_time", :description => "Retention time for Prometheus metrics", :type => 'string' + +attribute "consul/log_rotate_max_files", + :description => "Maximum number of older log file archives to keep. Default: 7", + :type => 'string' + +attribute "consul/log_rotate_bytes", + :description => "number of bytes that should be written to a log before it needs to be rotated. Default: 300mb", + :type => 'string' \ No newline at end of file diff --git a/templates/default/config/master.hcl.erb b/templates/default/config/master.hcl.erb index 6aa9204..3902447 100644 --- a/templates/default/config/master.hcl.erb +++ b/templates/default/config/master.hcl.erb @@ -37,4 +37,5 @@ telemetry = { disable_hostname = true } log_file = "<%= node['consul']['logs_dir'] %>/consul" -log_rotate_max_files = 7 +log_rotate_max_files = <%= node['consul']['log_rotate_max_files'] %> +log_rotate_bytes = <%= node['consul']['log_rotate_bytes'] %> diff --git a/templates/default/config/slave.hcl.erb b/templates/default/config/slave.hcl.erb index 34b64d5..805f2e7 100644 --- a/templates/default/config/slave.hcl.erb +++ b/templates/default/config/slave.hcl.erb @@ -26,4 +26,5 @@ telemetry = { disable_hostname = true } log_file = "<%= node['consul']['logs_dir'] %>/consul" -log_rotate_max_files = 7 \ No newline at end of file +log_rotate_max_files = <%= node['consul']['log_rotate_max_files'] %> +log_rotate_bytes = <%= node['consul']['log_rotate_bytes'] %> \ No newline at end of file