Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Add user and group attributes to logrotate conf
Browse files Browse the repository at this point in the history
  • Loading branch information
gsreynolds committed Jul 19, 2016
1 parent b10d5f5 commit 1baf547
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion recipes/core_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
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
Expand Down
17 changes: 8 additions & 9 deletions templates/default/icinga2.logrotate.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 1baf547

Please sign in to comment.