Multiple log outputs with different verbosity levels

What is the problem you are having with rclone?

How to get multiple log outputs with different verbosity levels.

I have an rclone job that runs as a systemd service triggered by a systemd timer.

I would like to get some general idea of what's happening when I run systemctl status rclone-download.service, but keep the full DEBUG log in a file. This could be achieved with the NOTICE output from rclone to stdout (or just some stats) and the DEBUG log to a file.

I could probably send the DEBUG log to syslog/journal/a script and filter/masage it and then pipe/split/forward it, but this feature would be great to have out of the box.

Current behavior:

  • Debug log gets stored in a file.
  • Systemd journal shows nothing when rclone service runs.
RCLONE_DEBUG_LOG_FILE="/path/to/log/dir/rclone-$(date +%FT%H%M%S).log"
rclone copy \
    --log-file="$RCLONE_DEBUG_LOG_FILE" \
    --log-level=DEBUG \
    source:dir/ /dest/dir/

Wanted behavior:

  • Debug log gets stored in a file.
  • Systemd journal would show NOTICE log level (or some stats) from rclone stdout.
RCLONE_DEBUG_LOG_FILE="/path/to/log/dir/rclone-$(date +%FT%H%M%S).log"
rclone copy \
    --log-file="$RCLONE_DEBUG_LOG_FILE" \    # first log to file
    --log-level=DEBUG \                      # DEBUG level for first log
    --log=stdout \                           # second log to stdout
    --log-level=NOTICE \                     # NOTICE level for second log
    source:dir/ /dest/dir/

Maybe there's something I can do with --stats-log-level?

What is your rclone version (output from rclone version)

v1.53.4

Which OS you are using and how many bits (eg Windows 7, 64 bit)

RHEL 7 x64

Which cloud storage system are you using? (eg Google Drive)

n/a

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone move --log-file="$RCLONE_DEBUG_LOG_FILE" --log-level=DEBUG source:dir/ /dest/dir/

The rclone config contents with secrets removed.

n/a

A log from the command with the -vv flag

n/a

You can use --syslog and also in rsyslog, you can capture that program name to a file.

You can use something simple like:

root@gemini:/etc/rsyslog.d# cat 60-rclone.conf
if $programname == 'rclone' then /var/log/rclone.log

I realize, but that's not quite what I'm looking for. Obviously I could massage the log in rsyslog with a variety of if-statements but that still won't show me stats or NOTICE in stdout.

Understood as the most common application would be to parse the logs to what you need rather than trying to moditfy the application to do multiple logs from my experience. Unknown how hard/much effort it is to do that as t would a feature request.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.