default['logrotate']['global']['rotate'] = 2
default['logrotate']['global']['compress'] = true
default['logrotate']['global']['weekly'] = true
default['logrotate']['global']['missingok'] = true
default['logrotate']['global']['maxsize'] = '50M'
default['logrotate']['global']['create'] = '0600 root root'

default['logrotate']['global']['/var/log/messages'] = {
  'create' => '0600 root root',
  'weekly' => false,
  'daily' => true,
  # TODO: /srv/rsyslog should not be generated at all! Check rsyslog configuration (also in chef-alfresco!)
  'postrotate' => ['rm -rf /srv/rsyslog; service rsyslog restart']
}
default['logrotate']['global']['/var/log/audit/audit.log'] = {
  'create' => '0600 root root',
  'weekly' => false,
  'daily' => true,
  'postrotate' => ['service auditd restart']
}
default['logrotate']['global']['/var/log/cron'] = {
  'create' => '0600 root root'
}
default['logrotate']['global']['/var/log/maillog'] = {
  'create' => '0600 root root'
}
default['logrotate']['global']['/var/log/wtmp'] = {
  'create' => '0600 root utmp',
  'weekly' => false,
  'monthly' => true
}
default['logrotate']['global']['/var/log/btmp'] = {
  'create' => '0600 root utmp',
  'weekly' => false,
  'monthly' => true
}
default['logrotate']['global']['/var/log/yum.log'] = {
  'notifempty' => true,
  'size' => '30k',
  'weekly' => false,
  'monthly' => true
}
default['logrotate']['global']['/var/log/chrony/*.log'] = {
  'nocreate' => true,
  'sharedscripts' => true,
  'weekly' => false,
  'monthly' => true,
  'postrotate' => ['/usr/libexec/chrony-helper command cyclelogs > /dev/null 2>&1 || true']
}
default['logrotate']['global']['/var/log/cloud-init.log'] = {
  'weekly' => false,
  'monthly' => true
}
default['logrotate']['global']['/var/log/chef-client.log'] = {
  'create' => '0600 root root',
  'weekly' => false,
  'daily' => true
}
default['logrotate']['global']['/var/log/salt/minion'] = {
  'create' => '0600 root root',
  'weekly' => false,
  'daily' => true,
  'postrotate' => ['service salt-minion restart']
}
default['logrotate']['global']['/var/log/chef-runs/*.json'] = {
  'create' => '0600 root root',
  'weekly' => false,
  'daily' => true
}

# TODO: move to chef-alfresco
# TODO: how to restart process without downtime
# node.default['logrotate']['global']['/var/log/mysql-default/error.log'] = {
#   'create' => '0600 mysql mysql',
#   'weekly' => false,
#   'daily' => true
# }
