The log files of my nodes are getting larger and larger within Docker. How have you organized for space management? Do you “prune” logs sometimes?
You could try this…
Hello,
I personnaly configure the docker log driver : Configure logging drivers | Docker Documentation
I just create this file : /etc/docker/daemon.json
with the following content :
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
it’s fine for me as I have docker only for for Storagenode and anyway 10m is enough for most cases.
I keep them all. Rotated on each node restart, so around every two weeks, then compressed with xz. This way they don’t take much space.
I am using log rotate with the following configuration:
sudo vi /etc/logrotate.d/storagenodes
/mnt/WD1003/logs/*.log
{
weekly
missingok
rotate 4
copytruncate
compress
notifempty
}
sudo logrotate -vf /etc/logrotate.d/
Plus the docker run command with the following parameters:
…
--log-opt max-size=1g \
--log-opt max-file=5 \
…
--mount type=bind,source="/mnt/WD1003/logs",destination=/app/logs \
…
hello.
The file or log has a size of 22 GB, is it normal for a Linux Ubuntu system (odroid) located at. ./var/lib/docker/containers/f67a9e8d8e31df3926e9830ea5f24cb69becb3dc4186476a705ce99097fe0fdf/f67a9e8d8e31df3926e9830ea5f24cb69becb3dc4186476a705ce99097fe0fdf-json.log?"
it takes space on /dev/mmcblk1p2 29G 28G 434M 99% /
thanks for the idea what to do
Hello @Ingacz,
Welcome to the forum!
You have several options:
- Specify docker logs parameters in your
docker run
command before the image name
- Set logs level to less verbose like
warn
orerror
in the storagenode’s option--log.level=warn
after the image name or in theconfig.yaml
in your data location as a parameter
log.level: warn
- Configure redirect to the file and configure a logrotate like described above: Docker Logs management - #5 by Bivvo
Stop and remove the container, pull a new image and run your node back using all your parameters, include changed ones.
Please also check - do you have a stopped container, which could be an owner of this log:
docker ps -a
ok
thank you, the place has become available
I added the parameter to run docker
docker run -d --restart unless-stopped --stop-timeout 300
-p 28967:28967/tcp
-p 28967:28967/udp \
-p 14002:14002
-e WALLET=“------------------------”
-e EMAIL=“-----------------------------”
-e ADDRESS=“----------------:28967”
-e STORAGE=“8TB”
–log-opt max-size=1g
–log-opt max-file=5
–mount type=bind,source=“/mnt/root/storagenode”,destination=/app/identity
–mount type=bind,source=“/mnt/root/storage”,destination=/app/config
–name storagenode storjlabs/storagenode:latest
I hope everything will be alright
thx