Merge branch 'sn/logrotate-dates' into 'master'

Add ablity to use dateformat for logrotate configuration

Personally I find it a lot easier to work with rotated log files when there is a date on the filename and not just a number.  

This change should configure logrotate to produce files with a date extension if ```logging['logrotate_dateformat']``` is set to something other than the default value of nil.

See merge request !680
This commit is contained in:
Marin Jankovski 2016-03-10 12:04:37 +00:00
commit 6667865dac
5 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@ omnibus-gitlab repository.
- Pass listen_network of gitlab_workhorse to gitlab nginx template 51b20e2
- Enable NGINX proxy caching 8b91c071
- Restart unicorn when bundled ruby is updated aca3cb2
- Add ablity to use dateformat for logrotate configuration (Steve Norman)
8.5.4

View File

@ -53,6 +53,8 @@ logging['logrotate_rotate'] = 30 # keep 30 rotated logs
logging['logrotate_compress'] = "compress" # see 'man logrotate'
logging['logrotate_method'] = "copytruncate" # see 'man logrotate'
logging['logrotate_postrotate'] = nil # no postrotate command by default
logging['logrotate_dateformat'] = nil # use date extensions for rotated files rather than numbers e.g. a value of "-%Y-%m-%d" would give rotated files like production.log-2016-03-09.gz
# You can add overrides per service
nginx['logrotate_frequency'] = nil

View File

@ -525,6 +525,7 @@ external_url 'GENERATED_EXTERNAL_URL'
# logging['logrotate_compress'] = "compress" # see 'man logrotate'
# logging['logrotate_method'] = "copytruncate" # see 'man logrotate'
# logging['logrotate_postrotate'] = nil # no postrotate command by default
# logging['logrotate_dateformat'] = nil # use date extensions for rotated files rather than numbers e.g. a value of "-%Y-%m-%d" would give rotated files like production.log-2016-03-09.gz
# Enterprise Edition only
# logging['udp_log_shipping_host'] = nil # remote host to ship log messages to via UDP
# logging['udp_log_shipping_port'] = 514 # remote host to ship log messages to via UDP

View File

@ -479,6 +479,7 @@ default['gitlab']['logging']['logrotate_rotate'] = 30 # keep 30 rotated logs
default['gitlab']['logging']['logrotate_compress'] = "compress" # see 'man logrotate'
default['gitlab']['logging']['logrotate_method'] = "copytruncate" # see 'man logrotate'
default['gitlab']['logging']['logrotate_postrotate'] = nil # no postrotate command by default
default['gitlab']['logging']['logrotate_dateformat'] = nil # use date extensions for rotated files rather than numbers e.g. a value of "-%Y-%m-%d" would give rotated files like production.log-2016-03-09.gz
###
# Remote syslog

View File

@ -5,6 +5,10 @@
<%= @options['logrotate_frequency'] %>
<%= "size #{@options['logrotate_size']}" if @options['logrotate_size'] %>
rotate <%= @options['logrotate_rotate'] %>
<% if @options['logrotate_dateformat'] %>
<%= "dateext" %>
<%= "dateformat #{@options['logrotate_dateformat']}" %>
<% end %>
<%= @options['logrotate_compress'] %>
<%= @options['logrotate_method'] %>
missingok