update cachewarmer syslog configuration including rotate (#1288)

This commit is contained in:
Anthony Howe 2021-07-18 04:59:32 -04:00 коммит произвёл GitHub
Родитель a37b277581
Коммит f5058ac019
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 43 добавлений и 2 удалений

Просмотреть файл

@ -79,6 +79,27 @@ function configure_rsyslog() {
# enable listen on port 514/TCP
sed -i 's/^#module(load="imtcp")/module(load="imtcp")/g' /etc/rsyslog.conf
sed -i 's/^#input(type="imtcp" port="514")/input(type="imtcp" port="514")/g' /etc/rsyslog.conf
# ensure the logs are rotating
if grep -F --quiet "/var/log/cachewarmer-manager.log" /etc/logrotate.d/rsyslog; then
echo "not updating /etc/logrotate.d/rsyslog, already there"
else
/bin/cat <<EOM >>/etc/logrotate.d/rsyslog
/var/log/cachewarmer-manager.log
{
rotate 2
daily
missingok
notifempty
compress
postrotate
/usr/lib/rsyslog/rsyslog-rotate
endscript
}
EOM
fi
# restart syslog
systemctl restart rsyslog
}

Просмотреть файл

@ -48,6 +48,26 @@ function configure_rsyslog() {
# enable listen on port 514/TCP
sed -i 's/^#module(load="imtcp")/module(load="imtcp")/g' /etc/rsyslog.conf
sed -i 's/^#input(type="imtcp" port="514")/input(type="imtcp" port="514")/g' /etc/rsyslog.conf
# ensure the logs are rotating
if grep -F --quiet "/var/log/cachewarmer-worker.log" /etc/logrotate.d/rsyslog; then
echo "not updating /etc/logrotate.d/rsyslog, already there"
else
/bin/cat <<EOM >>/etc/logrotate.d/rsyslog
/var/log/cachewarmer-worker.log
{
rotate 2
daily
missingok
notifempty
compress
postrotate
/usr/lib/rsyslog/rsyslog-rotate
endscript
}
EOM
fi
systemctl restart rsyslog
}

Просмотреть файл

@ -1,2 +1,2 @@
if $programname == 'cachewarmer-manager' or $syslogtag == 'cachewarmer-manager' then /var/log/cachewarmer/manager.log
if $programname == 'cachewarmer-manager' or $syslogtag == 'cachewarmer-manager' then /var/log/cachewarmer-manager.log
& stop

Просмотреть файл

@ -1,2 +1,2 @@
if $programname == 'cachewarmer-worker' or $syslogtag == 'cachewarmer-worker' then /var/log/cachewarmer/worker.log
if $programname == 'cachewarmer-worker' or $syslogtag == 'cachewarmer-worker' then /var/log/cachewarmer-worker.log
& stop