From d3eceae5ef4312115620daba2aa47b93e07e626a Mon Sep 17 00:00:00 2001 From: zhouhaibing089 Date: Mon, 12 Sep 2016 10:47:34 +0800 Subject: [PATCH] override the logrotate.conf without `su root syslog` --- image/services/syslog-ng/logrotate.conf | 36 +++++++++++++++++++++++++ image/services/syslog-ng/syslog-ng.sh | 1 + 2 files changed, 37 insertions(+) create mode 100644 image/services/syslog-ng/logrotate.conf diff --git a/image/services/syslog-ng/logrotate.conf b/image/services/syslog-ng/logrotate.conf new file mode 100644 index 0000000..cb2e78c --- /dev/null +++ b/image/services/syslog-ng/logrotate.conf @@ -0,0 +1,36 @@ +# see "man logrotate" for details +# rotate log files weekly +weekly + +# use the syslog group by default, since this is the owning group +# of /var/log/syslog. +# su root syslog + +# keep 4 weeks worth of backlogs +rotate 4 + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +#compress + +# packages drop log rotation information into this directory +include /etc/logrotate.d + +# no packages own wtmp, or btmp -- we'll rotate them here +/var/log/wtmp { + missingok + monthly + create 0664 root utmp + rotate 1 +} + +/var/log/btmp { + missingok + monthly + create 0660 root utmp + rotate 1 +} + +# system-specific logs may be configured here diff --git a/image/services/syslog-ng/syslog-ng.sh b/image/services/syslog-ng/syslog-ng.sh index f655756..2b0be4a 100755 --- a/image/services/syslog-ng/syslog-ng.sh +++ b/image/services/syslog-ng/syslog-ng.sh @@ -21,4 +21,5 @@ cp $SYSLOG_NG_BUILD_PATH/syslog-forwarder.runit /etc/service/syslog-forwarder/ru ## Install logrotate. $minimal_apt_get_install logrotate +cp $SYSLOG_NG_BUILD_PATH/logrotate.conf /etc/logrotate.conf cp $SYSLOG_NG_BUILD_PATH/logrotate_syslogng /etc/logrotate.d/syslog-ng