Browse Source

Improove the logrotate state with the map

master
Bogdan Radulescu 9 years ago
parent
commit
ee1208d5c7
2 changed files with 8 additions and 4 deletions
  1. +6
    -4
      apache/logrotate.sls
  2. +2
    -0
      apache/map.jinja

+ 6
- 4
apache/logrotate.sls View File

/etc/logrotate.d/apache2:
{% from "apache/map.jinja" import apache with context %}

{{ apache.logrotatedir }}:
file: file:
- managed - managed
- contents: | - contents: |
/var/log/apache2/*.log {
{{ apache.logdir }}/*.log {
daily daily
missingok missingok
rotate 14 rotate 14
create 640 root adm create 640 root adm
sharedscripts sharedscripts
postrotate postrotate
if /etc/init.d/apache2 status > /dev/null ; then \
/etc/init.d/apache2 reload > /dev/null; \
if /etc/init.d/{{ apache.service }} status > /dev/null ; then \
/etc/init.d/{{ apache.service }} reload > /dev/null; \
fi; fi;
endscript endscript
prerotate prerotate

+ 2
- 0
apache/map.jinja View File

'default_site': 'default', 'default_site': 'default',
'default_site_ssl': 'default-ssl', 'default_site_ssl': 'default-ssl',
'logdir': '/var/log/apache2', 'logdir': '/var/log/apache2',
'logrotatedir': '/etc/logrotate.d/apache2',
'wwwdir': '/srv', 'wwwdir': '/srv',
'use_require': False, 'use_require': False,
}, },
'default_site': 'default', 'default_site': 'default',
'default_site_ssl': 'default-ssl', 'default_site_ssl': 'default-ssl',
'logdir': '/var/log/httpd', 'logdir': '/var/log/httpd',
'logrotatedir': '/etc/logrotate.d/httpd',
'wwwdir': '/var/www', 'wwwdir': '/var/www',
'use_require': False, 'use_require': False,
}, },

Loading…
Cancel
Save