Skip to content

Commit

Permalink
[HWORKS-832] Set size limit in consul log files (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
kouzant authored Nov 9, 2023
1 parent 1ccbed5 commit 717ee0a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@

default['consul']['wan']['enabled'] = "false"
default['consul']['wan']['serf_port'] = "8302"
default['consul']['wan']['nodes'] = nil
default['consul']['wan']['nodes'] = nil

# 7 days
default['consul']['log_rotate_max_files'] = "7"
# 300mb
default['consul']['log_rotate_bytes'] = "314572800"
8 changes: 8 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
3 changes: 2 additions & 1 deletion templates/default/config/master.hcl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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'] %>
3 changes: 2 additions & 1 deletion templates/default/config/slave.hcl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,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'] %>

0 comments on commit 717ee0a

Please sign in to comment.