Docker node define max log size


is it possible define a max log size on a node running on docker ?


docker run -d --restart unless-stopped --stop-timeout 300 \
	-p 28967:28967/tcp \
	-p 28967:28967/udp \
	-p 14002:14002 \
	-p 5999:5999 \
	-e WALLET="...WALLET..." \
	-e EMAIL="...EMAIL..." \
	-e ADDRESS="...WAN_IP...:28967" \
	-e STORAGE="14TB" \
	--mount type=bind,source="/volume1/Storj/Identity/storagenode/",destination=/app/identity \
	--mount type=bind,source="/volume1/Storj/",destination=/app/config \
	--log-opt max-size=10m \
	--log-opt max-file=5 \
	--name storagenode storjlabs/storagenode:latest \
	--server.address=":28967" \
	--console.address=":14002" \
	--debug.addr=":5999" \
	--log.level=error \
	--filestore.write-buffer-size 4MiB \
	--pieces.write-prealloc-size 4MiB \
	--storage2.piece-scan-on-startup=true \
	--operator.wallet-features=zksync ```

What’s the machine? NAS or PC?

@brizio71 what @Roberto has shown you is what you want to do.

That’s a feature of Docker itself not of the storagenode, you have to use 2 flags

--log-opt max-size=10m 
--log-opt max-file=5 

and make sure that you are not setting the following storagenode configuration (via flag or in the configuration file)

log.output string     # can be stdout, stderr, or a filename (default "stderr")

or if you do, set it to stdout or stderr.

1 Like

if you want to apply the change to all containers then you should add

  "log-driver": "json-file",
  "log-opts": {
    "max-size": "50m",
    "max-file": "1" 

into /etc/docker/daemon.json then restart the docker daemon by

systemctl restart docker

I assume you use Linux, somebody may know how to do it on Windows.

1 Like