Better email log handling
This commit is contained in:
parent
8eb28483f0
commit
77993fb229
|
@ -1696,19 +1696,29 @@ function install_email {
|
|||
|
||||
function remove_ip_addresses_from_email_logs {
|
||||
{ echo '#!/bin/bash';
|
||||
echo 'if [ -f /var/log/exim4/mainlog ]; then';
|
||||
echo '';
|
||||
echo 'if grep -q "= /dev/null" /etc/php/7.0/fpm/php-fpm.conf; then';
|
||||
echo ' if [ -f /var/log/exim4/mainlog ]; then';
|
||||
echo ' rm /var/log/exim4/mainlog';
|
||||
echo ' fi';
|
||||
echo ' if [ -f /var/log/exim4/rejectlog ]; then';
|
||||
echo ' rm /var/log/exim4/rejectlog';
|
||||
echo ' fi';
|
||||
echo 'else';
|
||||
echo ' if [ -f /var/log/exim4/mainlog ]; then';
|
||||
echo " if grep -q '\\[' /var/log/exim4/mainlog; then";
|
||||
echo " tail -n 50 /var/log/exim4/mainlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_mainlog";
|
||||
echo ' chown Debian-exim:adm /tmp/.exim4_mainlog';
|
||||
echo ' mv /tmp/.exim4_mainlog /var/log/exim4/mainlog';
|
||||
echo ' fi';
|
||||
echo 'fi';
|
||||
echo 'if [ -f /var/log/exim4/rejectlog ]; then';
|
||||
echo ' fi';
|
||||
echo ' if [ -f /var/log/exim4/rejectlog ]; then';
|
||||
echo " if grep -q '\\[' /var/log/exim4/rejectlog; then";
|
||||
echo " tail -n 50 /var/log/exim4/rejectlog | sed 's/\\[[^][]*\\]//g' > /tmp/.exim4_rejectlog";
|
||||
echo ' chown Debian-exim:adm /tmp/.exim4_rejectlog';
|
||||
echo ' mv /tmp/.exim4_rejectlog /var/log/exim4/rejectlog';
|
||||
echo ' fi';
|
||||
echo ' fi';
|
||||
echo 'fi'; } > /usr/bin/exim_log_tidy
|
||||
chmod +x /usr/bin/exim_log_tidy
|
||||
cron_add_mins 1 '/usr/bin/exim_log_tidy'
|
||||
|
|
Loading…
Reference in New Issue