Logrotate type of behavior

So I am very much used to configure logrotate for various logs in Linux.

What is the default behavior with storj - docker logs (as seen in “docker logs --follow storagenode”)? Will it ever be rotated or will it grow infinitely until restart of the node?

As far as I can tell, It will grow indefinitely.
I moved the log location to an external folder and then rotated them.

Does it not seem to be problem then, if one can not leave node running without having to periodically restart it?

if you have enough room on the host OS you can just leave it.

I tend to restart my OS and docker at least once a month (for updates and housekeeping) so my logs were never huge in the first place. But I moved the log location out of the docker so that they could be saved between restarts in case their was issues.

@binary I just left the log in docker and then made this for exporting it, it might as noted take a little bit of performance, but i haven’t seen more than i could barely measure it…
and then one can use docker logs commands like --follow or --tail

haven’t setup any logrotate yet, but you could if you wanted deletion features and such, i just made a compressed folder for them and left it to pile up for future me to worry about lol

it might be a bit rough around the edges pretty new in linux so…

  • It won’t fill indefinitely, but rather only until the next time a container upgrade is done by watchtower. That will deleted the old container and thus the old logging
  • You can always start your container with the docker run sub-flag --log-opt max-size=50m, which will result in compressed logging which then gets deleted with container deletes

I personally run /var/lib/docker off the same disk as the storagenode file storage location, therefor roll with --log-opt max-size=50m.

You can use logrotate for the storage node logs as well. Here is my config /etc/logrotate.d/storagenode

/home/storagenode/storagenode1.log
/home/storagenode/storagenode2.log
/home/storagenode/storagenode3.log
/home/storagenode/storagenode4.log
{
        weekly
        missingok
        rotate 4
        copytruncate
        nocompress
        notifempty
        create 640 storagenode storagenode
        errors <my email address>
}

This config will truncate the existing logfile. The storage node will keep writing to the logfile. I am not compressing my log files at the moment. If you want to safe some space you should do that.

2 Likes

Don’t get me wrong :slight_smile: I do logrotate on my storj log file, I don’t leave it in docker but use log.output to write to file instead, and then rotate that. I was just wondering what happens for those who use default scenario

all inside the docker image, and then when the version is updated it’s gone.