Saltstack Official Logrotate Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.0KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=yaml
  3. ---
  4. logrotate:
  5. # default OS values can be overridden in 'lookup' dict
  6. # lookup:
  7. # pkg: logrotate
  8. # service: crond
  9. default_config:
  10. weekly: true
  11. rotate: 52
  12. create: true
  13. compress: true
  14. dateext: true
  15. jobs:
  16. /tmp/var/log/mysql/error:
  17. config:
  18. - weekly
  19. - missingok
  20. - rotate 52
  21. - compress
  22. - delaycompress
  23. - notifempty
  24. - create 640 root adm
  25. - sharedscripts
  26. mysql:
  27. path:
  28. - /tmp/var/log/mysql/*.log
  29. config:
  30. - weekly
  31. - missingok
  32. - rotate 52
  33. - compress
  34. - delaycompress
  35. - notifempty
  36. - create 640 root adm
  37. - sharedscripts
  38. syslog:
  39. path:
  40. - /var/log/cron
  41. - /var/log/maillog
  42. - /var/log/messages
  43. - /var/log/secure
  44. - /var/log/spooler
  45. - /var/log/slapd.log
  46. config:
  47. - sharedscripts
  48. - postrotate
  49. - /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
  50. - endscript
  51. nginx_high_traf:
  52. path:
  53. - /var/log/nginx_high_traf/*.log
  54. config:
  55. - hourly
  56. - missingok
  57. - rotate {{ 30 * 24 }} # keep 1 month's worth of hourly logs
  58. - compress
  59. - notifempty
  60. - dateext
  61. - dateformat .%Y-%m-%d-%H00
  62. - olddir /var/log/nginx_high_traf/archive
  63. - sharedscripts
  64. - postrotate
  65. - 'kill -USR1 $(cat /var/run/nginx_high_traf.pid)'
  66. - endscript
  67. nginx:
  68. contents: |
  69. /var/log/nginx/*.log{
  70. weekly
  71. missingok
  72. compress
  73. delaycompress
  74. notifempty
  75. create 0640 www-data adm
  76. sharedscripts
  77. prerotate
  78. if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
  79. run-parts /etc/logrotate.d/httpd-prerotate; \
  80. fi \
  81. endscript
  82. postrotate
  83. invoke-rc.d nginx rotate >/dev/null 2>&1
  84. endscript
  85. }