文章目录
- 清除日志
- 查看现在每个docker容器中的日志量
清除日志
#!/bin/bash
echo "======== start clean docker containers logs ========"
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logsdoecho "clean logs : $log"cat /dev/null > $logdone
echo "======== end clean docker containers logs ========"
查看现在每个docker容器中的日志量
for d in $(ls -d /var/lib/docker/containers/*); do ls --time-style=long-iso -lh $d/*-json.log | awk -F' *|/' '{printf("%30s\t%s\t%s %s\t%s\n", "'$(docker ps -af id=${d##*/} --format "table {{.Names}}" | tail -1)'", $5, $6, $7, $14) }'; done