我可以阻止 /usr/bin/mail 在 syslog 中放入大量二进制数据吗

我可以阻止 /usr/bin/mail 在 syslog 中放入大量二进制数据吗

我在 Raspberry Pi Model 3B 上运行 Linux 9。

我定期通过 CRONTAB 启动一项任务,通过电子邮件发送 (/usr/bin/mail) 一些文件。工作中的任务和我得到的文件。但是,它还在附件的系统日志中记录二进制数据。这会导致 SYSLOG 变得非常大并且几乎无法使用。如何禁止将此日志记录到 SYSLOG?

编辑/更新 2022 年 8 月 21 日 以下是一位评论者要求的一些附加信息。

这是 CRONTAB 中的命令行:

0 0 * * * /usr/pgms/sendtome.sh "PiV2"  "AcuritePgmLog.txt;todaydata.txt;rainfall3.txt;Acurite_error.log;"  > /mnt/usbdrive/output/CRON_output.txt 2>&1

这是 sendtome.sh 脚本:

cat /usr/pgms/sendtome.sh
#!/bin/bash
MyPath="/mnt/usbdrive/output/"
TO="[email protected]"
MESSAGEx="Midnight `date '+%Y-%m-%d %H:%M:%S %Z'` $HOSTNAME Pi report"
echo $MESSAGEx
temp=$(echo $2 | tr ";" "\n")
for file in $temp
do
    echo "> [$file]"
done
/usr/bin/mysql -uxyz -pzz -e "select * from pidata WHERE (Date_Reading > DATE_ADD((SELECT MAX(Date_Reading) FROM pidata), INTERVAL -3 HOUR))" acurite > /mnt/usbdrive/output/todaydata.txt
declare -a attargs
for att in $temp; do
  x=$MyPath$att
  echo $x
  attargs+=( "-A" "$x" )
done
echo ${attargs[@]}
echo $MESSAGEx | /usr/bin/mail -s "$1" "$TO" ${attargs[@]}```

这是 CRON_output.txt 文件:

cat /mnt/usbdrive/output/CRON_output.txt
Midnight 2022-08-21 00:00:02 CEST PiV2 Pi report
> [AcuritePgmLog.txt]
> [todaydata.txt]
> [rainfall3.txt]
> [Acurite_error.log]
/mnt/usbdrive/output/AcuritePgmLog.txt
/mnt/usbdrive/output/todaydata.txt
/mnt/usbdrive/output/rainfall3.txt
/mnt/usbdrive/output/Acurite_error.log
-A /mnt/usbdrive/output/AcuritePgmLog.txt -A /mnt/usbdrive/output       /todaydata.txt -A /mnt/usbdrive/output/rainfall3.txt -A /mnt/usbdrive/output/Acurite_error.log

最后,这是昨晚 Pi 上的系统日志文件的摘录。之前的几行与下面第一行的内容类似:

Aug 21 00:00:23 PiV2 sSMTP[10264]: IHRvIGh0dHA6Ly93d3cucmRrc2Nvcm5lci5jb20vcmRrL2FzcC9QaUFsbERhdGFXcml0ZTJGaWxl
Aug 21 00:00:23 PiV2 sSMTP[10264]: QWN1cml0ZV9CYXR0ZXJ5LmFzcDogRXJyb3IgIyB0aW1lZCBvdXQK
Aug 21 00:00:23 PiV2 sSMTP[10264]: --2113075354-1661032807=:10262--
Aug 21 00:00:23 PiV2 sSMTP[10264]: .
Aug 21 00:00:28 PiV2 sSMTP[10264]: 250 2.0.0 OK  1661032828 p8-20020a17090653c800b007305d408b3dsm607286ejo.78 - gsmtp
Aug 21 00:00:28 PiV2 sSMTP[10264]: QUIT
Aug 21 00:00:28 PiV2 sSMTP[10264]: 221 2.0.0 closing connection p8-20020a17090653c800b007305d408b3dsm607286ejo.78 - gsmtp
Aug 21 00:00:28 PiV2 sSMTP[10264]: Sent mail for xx@PiV2 (221 2.0.0 closing connection p8-20020a17090653c800b007305d408b3dsm607286ejo.78 - gsmtp) uid=1001 username=xx outbytes=1962655

我希望这有助于解释这种情况。哦,是的,这是 SSMTP.conf 文件

 cat /etc/ssmtp/ssmtp.conf
# Config file for sSMTP sendmail
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=PiV2
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
#FromLineOverride=YES
[email protected]
AuthPass=123456789012
FromLineOverride=YES
UseSTARTTLS=YES
UseTLS=YES
Debug=YES

...RDK

相关内容