skip to Main Content

I host some personal services on a remote server running docker. This service is storing it’s data in a docker volume.

I’m doing some backups from my NAS at home using rsync:

rsync --recursive --archive --stats 
      --rsync-path="docker run -v my_vol:/my/path rsync-image rsync --quiet --log-file=/dev/null" 
      -e ssh user@host:/my/path /local/directory

It works well, but rsync writes a massive amount of things on the container stdout, which are then forwarded to my Datadog account and ends up in way too much logs stored there.

I know I can disable logs capture from this specific container but then I would miss potential errors, so I’m looking for a way to make the rsync server less verbose.

The Dockerfile for rsync-image is very basic:

FROM alpine:latest

# Install Rsync and SSH.
RUN apk update 
 && apk upgrade 
 && apk add --no-cache 
            rsync 
            openssh-client-default 
            sshpass 
            ca-certificates tzdata 
 && update-ca-certificates 
 && rm -rf /var/cache/apk/*

# The UID:GID for www-data in Debian/Ubuntu doesn't match with the IDs in Alpine:
#
# | user : group        | Debian/Ubuntu (uid:gid) | Alpine (uid:gid) |
# | www-data : www-data |         33 : 33         |     82 : 82      |
# | xfs : xfs           |            -            |     33 : 33      |
RUN addgroup nobody xfs

# Run unprivileged
USER nobody

I already tried with –quiet in both –rsync-path and the main rsync command, but it did not change anything

What am I missing?

2

Answers


  1. Chosen as BEST ANSWER

    After investigating, it appears that using --rsync-path="command" leads to the remote host running command --server {some-socket}.

    In this configuration the socket (and apparently stdout) is used to actually transfer the file, so it appears that there is no way to not print on stdout since it is the actual file transfer.


  2. According to the rsync man page, this option suppresses non-error messages:

    -q, --quiet                 suppress non-error messages
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search