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 ==="
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · Amazon Linux 2023 安装Docker和Docker Compose
- · 修改Docker的默认网段
- · docker定时任务Mysql脚本
- · 解决Linux实例磁盘空间满问题
- · failed to fetch metadata: fork/exec /home/appuser/.docker/cli-plugins/docker-buildx: exec format error
- · Docker登录login报错Error saving credentials
- · docker安装mysql8注意事项
- · 黑群晖docker无法pull镜像,x509错误解决方法
- · k3s+kuboard快速搭建K8s生产环境集群
- · 解决es报错:blocked by: [FORBIDDEN/12/index read-only / allow delete (api) ]
- · filebeat按docker容器名创建不同的索引
- · traefik负载均衡/滚动升级