log - send logs to remote syslog server

This commit is contained in:
bunkerity 2021-04-27 09:30:10 +02:00
parent 5ce41edc03
commit b4df287228
No known key found for this signature in database
GPG key ID: 3D80806F12602A7C
2 changed files with 9 additions and 0 deletions

View file

@ -19,3 +19,10 @@ touch /var/log/jobs.log
replace_in_file "/etc/logrotate.conf" "%LOGROTATE_MAXAGE%" "$LOGROTATE_MAXAGE"
replace_in_file "/etc/logrotate.conf" "%LOGROTATE_MINSIZE%" "$LOGROTATE_MINSIZE"
echo "$LOGROTATE_CRON /opt/scripts/logrotate.sh > /dev/null 2>&1" >> /etc/crontabs/nginx
# setup rsyslog
if [ "$REMOTE_SYSLOG" != "" ] ; then
replace_in_file "/etc/rsyslog.conf" "%REMOTE_SYSLOG%" "local0.* @${REMOTE_SYSLOG};rawFormat"
else
replace_in_file "/etc/rsyslog.conf" "%REMOTE_SYSLOG%" ""
fi

View file

@ -25,3 +25,5 @@ module(load="imuxsock" SysSock.Name="/tmp/log")
$template rawFormat,"%msg:2:2048%\n"
local0.=notice /var/log/access.log;rawFormat
local0.*;local0.!=notice /var/log/error.log;rawFormat
%REMOTE_SYSLOG%