How to switch log levels

Does someone know how to switch logs to warning/error level?
my practics show that i need logs only when bad thing happen, and then log file is over 2-3 gb and no one text redaktor can open it.
so i wold consider to see less but urgently needed information.

On Windows, PilotEdit can. The free version should be enough for reading these logs. Though, I usually just use command line.

you can configure log level in config.yaml
but i kinda like having logs atleast for some nodes…
but my logs are split into daily log files.

i usually set it to log level debug…
think some of the other options are error and warning.

can’t seem to find any documentation on it in the storj doc’s
tsk tsk… and not defined in the config.yaml notes either… tsk tsk

maybe you just use the names of the lines in the log, like warn, error and such…
then it will log everything below the one you define…

something like that…
sometimes storj documentation needs a lot of work.
this is pretty fundamental stuff.

@Alexey maybe you can help us out here…
what exactly are the log level options in the config.yaml and why can’t we seem to find that in the documentation?

We use this package, these are the levels:

I prefer to set these arguments on the command-line rather than the config file:

docker run -it storjlabs/storagenode:latest --log.level=error

To see all available storagenode arguments you can run:

docker run -it storjlabs/storagenode:latest --help

But I agree some of them need better documentation. PR welcome for here private/logging.go at 79135887c9bef0154d32fd1a26c5f0a25905acfa · storj/private · GitHub

4 Likes

thank you this is what I need.

There is also a way to change the log level without having to restart the node. This is useful for a hard to reproduce situation. Something is wrong on your node now but if you restart it with a different log level the restart itself would hide the root cause.

So here is how you can change the log level on the fly without a restart:
Guide to debug my storage node, uplink, s3 gateway, satellite

3 Likes

Does storagenode-updater have this log level setting, too?

the change to the storagenode-updater hasn’t changed anything in regard to logs.
its just how the docker image and such functions.

in the past the docker image would contain the storagenode, today it contains the storagenode updater and that then checks and updates the node when its started.

or something like that.
and i say docker image, because i haven’t run windows based nodes nor the linux binary, but it would be pretty much the same thing.

Yes, it have

storagenode-updater --help | grep log

not sure how to pass them though for the docker version

1 Like

Same, hence the question. I see it logs all checks and attempts to update, so thought to ask. It’s better to not log so much when not needed. Eats disk space on machines with some more nodes.

You may try to pass the argument via RUN_PARAMS environment variable, see

1 Like