查看docker容器日志
1 2 3 4 5 6 7 8 9 10 11
| #!/bin/sh
echo "======== docker containers logs file size ========"
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logs do ls -lh $log done
|
给权限
1 2 3 4
| # chmod +x docker_log_size.sh
# ./docker_log_size.sh
|
清理日志
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| #!/bin/sh echo "======== start clean docker containers logs ========" logs=$(find /var/lib/docker/containers/ -name *-json.log) for log in $logs do echo "clean logs : $log" cat /dev/null > $log done
echo "======== end clean docker containers logs ========"
|
赋予权限
1 2 3
| # chmod +x clean_docker_log.sh
# ./clean_docker_log.sh
|
参考:
https://blog.csdn.net/yjk13703623757/article/details/80283729