docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
757 stars 86 forks source link

Docker caching logs #1341

Open mateuszk89 opened 2 years ago

mateuszk89 commented 2 years ago

Expected behavior

Expecting 6 cache files size 25m.

Actual behavior

Currently 5 cache files size 20m, parameters "cache-max-size" and "cache-max-file" not working.

Steps to reproduce the behavior

It some problem with caching docker logs from containers. When we use:
“gelf-address”: “tcp://xxxxxxxx”,
“cache-max-size”: “25m”,
“cache-max-file”: “6”
Cache parameters doesn’t work, every time we have 5 files, 20m size. 

ls -l /var/lib/docker/containers/61fdb6e55784853db2ee40a2d0b7a76952fe930ae40eaaf42ed81f76a77ea7e7/
razem 6044
drwx------. 2 root root 6 12-01 14:38 checkpoints
-rw-------. 1 root root 6537 12-01 14:38 config.v2.json
-rw-r-----. 1 root root 998446 12-01 16:06 container-cached.log
-rw-r-----. 1 root root 1287207 12-01 15:22 container-cached.log.1.gz
-rw-r-----. 1 root root 1290002 12-01 15:15 container-cached.log.2.gz
-rw-r-----. 1 root root 1289806 12-01 15:07 container-cached.log.3.gz
-rw-r-----. 1 root root 1291118 12-01 14:59 container-cached.log.4.gz
-rw-r–r–. 1 root root 2190 12-01 14:38 hostconfig.json
-rw-r–r–. 1 root root 29 12-01 14:38 hostname
-rw-r–r–. 1 root root 1817 12-01 14:38 hosts
drwx–x—. 3 root root 17 12-01 14:38 mounts
-rw-r–r–. 1 root root 122 12-01 14:38 resolv.conf

Output of docker version:

Client: Docker Engine - Community
Version: 20.10.11
API version: 1.41
Go version: go1.16.9
Git commit: dea9396
Built: Thu Nov 18 00:38:53 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.11
API version: 1.41 (minimum version 1.12)
Go version: go1.16.9
Git commit: 847da18
Built: Thu Nov 18 00:37:17 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 45
 Server Version: 20.10.11
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: gelf
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.31.1.el7.x86_64
 Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.62GiB
 Name: dltkdpwprd01.prd.dlt.kdpw.pl
 ID: ZQDB:SQH3:YJ7T:E3XT:DAQQ:JO3B:K5SF:UNUR:GK5P:7B4X:4LLD:IITC
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.)

docker inspect api.evoting
        "ContainerIDFile": "",
        "LogConfig": {
            "Type": "gelf",
            "Config": {
                "cache-max-file": "6",
                "cache-max-size": "25m",
                "gelf-address": "tcp://xx.xx.xx.xx:xxxx"
            }
        },
danisabad commented 7 months ago

Still true for v25