Lets talk about logs

Hi,

I don't know about you - however I find it useful to switch to the DEBUG log level when ironing out issues, at some points I do so for several days at a time.

The problem we face is:

  • Switching to the DEBUG log level is a restart of the service (therefore a pain for any mount and downstream dependencies)
  • The logs get big very quickly

I propose two items,

Signal for log level

How about a SIG (or rc command) to change INFO/DEBUG/etc log levels? This avoids restarts and you can always revert to avoid spamming your logs.

Log management

I can hear the collective groan - logrotation is a menial task and therefore should not be part of the product, a --logrotate on size/time would_be_nice as alternate options are even harder.

Alternative option: Most of my rclone's live in containers, the official container works wonders however it is using the base Alpine image which has no linuxserver.io-style custom-services.d or similar, therefore injecting a quick logrotate install + cron in your docker compose file means starting/maintaining your own Dockerfile which goes against the current quick-and-easy-deployments

Thoughts?

You can set the log level via the RC already

rclone rc options/set --json '{"main": {"LogLevel": "DEBUG"}}'

And this sets INFO level logs (-v)

rclone rc options/set --json '{"main": {"LogLevel": "INFO"}}'

I believe there is an issue about this: Implement logrotate solution · Issue #2259 · rclone/rclone · GitHub

logrotate works well for unix users, but doesn't work well for Windows users, and in general is a bit of a pain to setup if you aren't used to it.

I would look kindly upon a patch integrating lumberjack (say).

1 Like

@ncw Thanks for that! Somehow I missed it - Remote Control / API for anybody else will take you to the relevant section.

Yeah I've been using logrotate for the logs (unix) for ages and it works well however once containerised it is a pain for the above-mentioned reasons, agree that something-like lumberjack integration is the way to go, will certainly keep a eye on that issue!

Appreciate the response and pointers!

1 Like