![/usr/bin/mail이 syslog에 대량의 바이너리 데이터를 저장하는 것을 방지할 수 있습니까?](https://linux55.com/image/209714/%2Fusr%2Fbin%2Fmail%EC%9D%B4%20syslog%EC%97%90%20%EB%8C%80%EB%9F%89%EC%9D%98%20%EB%B0%94%EC%9D%B4%EB%84%88%EB%A6%AC%20%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC%20%EC%A0%80%EC%9E%A5%ED%95%98%EB%8A%94%20%EA%B2%83%EC%9D%84%20%EB%B0%A9%EC%A7%80%ED%95%A0%20%EC%88%98%20%EC%9E%88%EC%8A%B5%EB%8B%88%EA%B9%8C%3F.png)
저는 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