25
08/22
docker日志分割
#!/bin/sh echo "===start collect docker containers logs ====" logfile=/home/xxx/app/logs/prod`date -d "-1 day" +%Y%m%d`.log logs=$(find /home/xxx/.local/share/containers/storage/ -name ctr.log) for log in $logs; do echo "collect logs:" echo $logfile cat $log>$logfile cat /dev/null > $log echo "logs cleared." done echo "===end collect docker containers logs ==="