cookbooks/fb_logrotate/templates/default/fb_logrotate.conf.erb (58 lines of code) (raw):

<% defaultrotation = 'daily' -%> # globals <%= defaultrotation %> rotate <%= node['fb_logrotate']['globals']['rotate'] %> maxage <%= node['fb_logrotate']['globals']['maxage'] %> compresscmd <%= node['fb_logrotate']['globals']['compresscmd'] %> copytruncate <% if node['fb_logrotate']['globals']['nocompress'] -%> nocompress <% else -%> compress <% end -%> notifempty missingok <% if node['fb_logrotate']['globals']['dateext'] -%> dateext <% end -%> <% if node['fb_logrotate']['globals']['dateformat'] -%> dateformat <%= node['fb_logrotate']['globals']['dateformat'] %> <% end -%> <% if node['fb_logrotate']['globals']['size'] -%> size <%= node['fb_logrotate']['globals']['size'] %> <% end -%> <% if node['fb_logrotate']['globals']['compressext'] -%> compressext <%= node['fb_logrotate']['globals']['compressext'] %> <% end -%> <% node['fb_logrotate']['configs'].to_hash.each do |name, block| %> ## fb.fb_logrotate.configs.<%= name %> <%= block['files'].join(' ') %> { <% if block['time'] -%> <%= block['time'] %> <% end -%> <% if block['overrides'] -%> <% block['overrides'].keys.sort.each do |k| -%> <% case k -%> <% when 'rotate', 'maxage', 'minsize', 'create', 'olddir', 'su', 'compressoptions', 'dateformat', 'maxsize', 'compresscmd', 'compressext' -%> <%= k %> <%= block['overrides'][k] %> <% when 'copytruncate', 'ifempty', 'nocompress', 'missingok', 'delaycompress', 'sharedscripts', 'nomail', 'dateext', 'nodateext', 'noolddir', 'nocopytruncate', 'nocreate' -%> <%# check that the value is true -%> <% if block['overrides'][k] -%> <%= k %> <% end -%> <% when 'postrotate', 'prerotate', 'preremove' -%> <%= k %> <%= block['overrides'][k] %> endscript <% else -%> <% Chef::Log.warn("fb_logrotate:[#{name}]: \ Invalid logrotate config option #{k}") -%> <% end -%> <% end -%> <% end -%> } <% end -%>