[icinga-checkins] icinga.org: chef-icinga2/master: Add user and group attributes to logrotate conf

git at icinga.org git at icinga.org
Tue Jul 19 18:05:05 CEST 2016


Module: chef-icinga2
Branch: master
Commit: 1baf547f18225cea177a48ba872f0d56a2ee57c0
URL:    https://git.icinga.org/?p=chef-icinga2.git;a=commit;h=1baf547f18225cea177a48ba872f0d56a2ee57c0

Author: Gavin Reynolds <g.reynolds at src.gla.ac.uk>
Date:   Tue Jul 19 10:05:12 2016 +0100

Add user and group attributes to logrotate conf

---

 recipes/core_config.rb                  |    2 +-
 templates/default/icinga2.logrotate.erb |   17 ++++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/recipes/core_config.rb b/recipes/core_config.rb
index 7094c9e..b18420e 100644
--- a/recipes/core_config.rb
+++ b/recipes/core_config.rb
@@ -63,7 +63,7 @@ template '/etc/logrotate.d/icinga2' do
   owner 'root'
   group 'root'
   mode 0o644
-  variables(:log_dir => node['icinga2']['log_dir'])
+  variables(:log_dir => node['icinga2']['log_dir'], :user => node['icinga2']['user'], :group => node['icinga2']['group'])
 end
 
 # icinga2.conf
diff --git a/templates/default/icinga2.logrotate.erb b/templates/default/icinga2.logrotate.erb
index ba98f72..988f1f7 100644
--- a/templates/default/icinga2.logrotate.erb
+++ b/templates/default/icinga2.logrotate.erb
@@ -4,32 +4,31 @@
 #
 
 <%= @log_dir -%>/icinga2.log <%= @log_dir -%>/debug.log {
-  daily
+	daily
 	rotate 7
-	su icinga icinga
+	su <%= @user -%> <%= @group %>
 	compress
 	delaycompress
-  missingok
-  notifempty
-  create 644 icinga icinga
+	missingok
+	notifempty
+	create 644 <%= @user -%> <%= @group %>
 	copytruncate
 	postrotate
 		if ! killall -q -USR1 icinga2; then
 			exit 1
 		fi
-  endscript
+	endscript
 }
 
 <%= @log_dir -%>/error.log {
 	daily
-	su icinga icinga
+	su <%= @user -%> <%= @group %>
 	rotate 90
 	compress
 	delaycompress
 	missingok
 	notifempty
-	create 644 icinga icinga
+	create 644 <%= @user -%> <%= @group %>
 	copytruncate
 	# TODO: figure out how to get Icinga to re-open this log file
 }
-



More information about the icinga-checkins mailing list