0

TL;DR

Is there some configuration for rsnapshot (see versions below) that would allow me to restrict output to the shell commands, errors and start/finish notifications generated by rsnapshot itself, while causing rsync to generate and record the desired level of detail only in the rsync log file? Or put more succinctly, can I make the results of rsnapshot output match the descriptions of verbosity in the rsnapshot config file?

If not, is there an rsnapshot community that takes feature requests?

Just the TL part...

It appears after some troubleshooting (see below) that my particular combination of rsnapshot and rsync no longer works as it did for the previous several years. Specifically, the output from rsync now shows up in the console output of rsnapshot, regardless of the verbose settings in rsnapshot.conf. I have a fresh install of FreeBSD 12.2

freebsd-version   
12.2-RELEASE-p10

rsync was installed as part of pkg install rsnapshot, and rsync -V shows

rsync  version 3.2.3  protocol version 31
Copyright (C) 1996-2020 by Andrew Tridgell, Wayne Davison, and others.
Web site: https://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, hardlink-specials, symlinks, IPv6, atimes,
    batchfiles, inplace, append, ACLs, xattrs, optional protect-args, iconv,
    symtimes, no prealloc, stop-at, no crtimes, file-flags
Optimizations:
    no SIMD, no asm, openssl-crypto
Checksum list:
    xxh128 xxh3 xxh64 (xxhash) md5 md4 none
Compress list:
    zstd lz4 zlibx zlib none

current version of rsnapshot is:

my $VERSION = '1.4.4';

The issue, after posting the original form of this question, and sleeping on it, plus the aforementioned troubleshooting, boils down to this: rsnapshot runs from crontab, and the unnecessary information from rsync appearing in the console output (despite the verbose 1 setting) seems to requires a "wrapper" script to suppress the noise, and then assemble the correct information from the rsnapshot log. This seems like a very error-prone process, and one that is also likely to be very high-maintenance, as upgrades break the duct-tape nature of the workaround.

The least-cost path seems to be to give up on getting any stats information on the effectiveness of the rsync transfer. This allows me to maintain readability for monitoring the success/failure of the rsync, and to easily re-run it when it does fail.

Clearly something has changed, I suspect with rsync (an implicit -v setting?), and if there's some configuration that would allow me to get what I want in the rsnapshot output (only the shell commands, errors and start/finish notifications) while recording the rsync output in the rsync log file, I'd sure love to know about it.

Please keep in mind the rsnapshot regime has been running perfectly since 2018, and only doing a fresh install of FreeBSD 12.2 broke it. The previous rsnapshot regime was running (on the same hardware) on an upgraded FreeBSD 12.1 (started as 10.x). rsync and rsnapshot were originally built separately (in that order) from the FreeBSD 10.x ports, and upgraded regularly since then with portmaster.

This time (as mentioned) I installed rsnapshot with pkg, and let it install rsync (and everything else it neeeded).

rsnapshot.conf changed only in the value of snapshot_root and a shortened list of backup points.

Here's the output I want (easy-to-process) for the monitoring emails (that is, without all the rsync noise):

Wed Oct 20 21:40:00 PDT 2021
=================================================================

echo 98875 > /var/run/rsnapshot.pid 
mv /obo-offsitepool/archives/daily.5/ /obo-offsitepool/archives/daily.6/ 
mv /obo-offsitepool/archives/daily.4/ /obo-offsitepool/archives/daily.5/ 
mv /obo-offsitepool/archives/daily.3/ /obo-offsitepool/archives/daily.4/ 
mv /obo-offsitepool/archives/daily.2/ /obo-offsitepool/archives/daily.3/ 
mv /obo-offsitepool/archives/daily.1/ /obo-offsitepool/archives/daily.2/ 
native_cp_al("/obo-offsitepool/archives/daily.0", \
    "/obo-offsitepool/archives/daily.1") 
/usr/local/bin/rsync -a --delete --numeric-ids \
    /obo-offsitepool/archives/daily.0/ /obo-offsitepool/archives/daily.1/ 
/usr/local/bin/rsync -rltv --chmod D0770,F0660 --delete --relative \
    --delete-excluded --partial --stats --log-file=/var/log/rsync \
    --human-readable \
    --exclude-from=/obo-offsitepool/archives/.rsnapshot_excludes \
    /usr/local/etc/ \
    /obo-offsitepool/archives/daily.0/obo-offsite1/local_etc/ 
/usr/local/bin/rsync -rltv --chmod D0770,F0660 --delete --relative \
    --delete-excluded --partial --stats --log-file=/var/log/rsync \
    --human-readable \
    --exclude-from=/obo-offsitepool/archives/.rsnapshot_excludes \
    192.168.18.3::srv330-group/ \
    /obo-offsitepool/archives/daily.0/CSO/srv330-group 
... etc

Rather than this (keeping in mind there are >20 backup points, many with hundreds of lines of unwanted rsync output):

Tue Oct 26 18:55:00 PDT 2021
=================================================================

echo 97810 > /var/run/rsnapshot.pid 
/bin/rm -rf /obopool/archives/daily.6/ 
mv /obopool/archives/daily.5/ /obopool/archives/daily.6/ 
mv /obopool/archives/daily.4/ /obopool/archives/daily.5/ 
mv /obopool/archives/daily.3/ /obopool/archives/daily.4/ 
mv /obopool/archives/daily.2/ /obopool/archives/daily.3/ 
mv /obopool/archives/daily.1/ /obopool/archives/daily.2/ 
native_cp_al("/obopool/archives/daily.0", \
    "/obopool/archives/daily.1") 
/usr/local/bin/rsync -a --delete --numeric-ids \
    /obopool/archives/daily.0/ /obopool/archives/daily.1/ 
/usr/local/bin/rsync -rltv --chmod D0770,F0660 --delete --relative \
    --delete-excluded --partial --stats --log-file=/var/log/rsync \
    --human-readable \
    --exclude-from=/obopool/archives/.rsnapshot_excludes /usr/local/etc/ \
    /obopool/archives/daily.0/offsite1/local_etc/ 
sending incremental file list
/usr/
deleting usr/local/etc/ssmtp/ssmtp.conf.sample
deleting usr/local/etc/ssmtp/ssmtp.conf.2021-01-20
deleting usr/local/etc/ssmtp/ssmtp.conf
deleting usr/local/etc/ssmtp/revaliases.sample
deleting usr/local/etc/ssmtp/revaliases
deleting usr/local/etc/ssmtp/
deleting usr/local/etc/dma/dma.conf.sample
deleting usr/local/etc/dma/dma.conf
deleting usr/local/etc/dma/auth.conf.sample
deleting usr/local/etc/dma/auth.conf
deleting usr/local/etc/dma/
deleting usr/local/etc/portmaster.rc.sample
deleting usr/local/etc/papersize.letter
deleting usr/local/etc/papersize.a4
deleting usr/local/etc/bash_completion.d/portmaster.sh
deleting usr/local/etc/rc.d/dma_flushq
/usr/local/
/usr/local/etc/
/usr/local/etc/rsnapshot.conf
/usr/local/etc/rsnapshot.conf.default
/usr/local/etc/rsnapshot.conf_2018-09-08
/usr/local/etc/rsnapshot.conf_2019-06-14
/usr/local/etc/rsnapshot.conf_2019-08-23
/usr/local/etc/rsnapshot.conf_2021-02-01
/usr/local/etc/rsnapshot.conf_2021-06-21
/usr/local/etc/screenrc
/usr/local/etc/screenrc.sample
/usr/local/etc/smartd.conf
/usr/local/etc/smartd.conf.sample
/usr/local/etc/smartd_warning.sh
/usr/local/etc/bash_completion.d/
/usr/local/etc/man.d/
/usr/local/etc/man.d/perl5.conf
/usr/local/etc/newsyslog.conf.d/
/usr/local/etc/newsyslog.conf.d/rsnapshot
/usr/local/etc/newsyslog.conf.d/rsync
/usr/local/etc/newsyslog.conf.d/rsyncd
/usr/local/etc/periodic/
/usr/local/etc/periodic/daily/
/usr/local/etc/periodic/daily/smart
/usr/local/etc/periodic/security/
/usr/local/etc/periodic/weekly/
/usr/local/etc/rc.d/
/usr/local/etc/rc.d/rsyncd
/usr/local/etc/rc.d/smartd
/usr/local/etc/rc.d/uuidd
/usr/local/etc/rsync/
/usr/local/etc/rsync/rsyncd.conf
/usr/local/etc/rsync/rsyncd.conf.sample
/usr/local/etc/smartd_warning.d/
/usr/local/etc/ssl/
/usr/local/etc/ssl/cert.pem

Number of files: 46 (reg: 31, dir: 14, link: 1)
Number of created files: 4 (reg: 3, dir: 1)
Number of deleted files: 16 (reg: 14, dir: 2)
Number of regular files transferred: 23
Total file size: 774.49K bytes
Total transferred file size: 735.92K bytes
Literal data: 735.92K bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 738.45K
Total bytes received: 1.10K

sent 738.45K bytes  received 1.10K bytes  1.48M bytes/sec
total size is 774.49K  speedup is 1.05
/usr/local/bin/rsync -rltv --chmod D0770,F0660 --delete --relative \
    --delete-excluded --partial --stats --log-file=/var/log/rsync \
    --human-readable \
    --exclude-from=/obopool/archives/.rsnapshot_excludes \
    192.168.18.3::srv330-group/ \
    /obopool/archives/daily.0/CSO/srv330-group 
receiving incremental file list
CSO2/Lori/
CSO2/Lori/retail.prices2.docx
Retail/
...etc

Both of the above email reports were produced from the same rsnapshot.conf file.

Here's the troubleshooting I've been doing. Test 4 is the best approximation to what I had previously.

1
rsnapshot -v alpha && /root/scripts/marklogs.sh --> using default rsnapshot.conf with 
 entries for rsync_short_args AND rsync_long_args  were actually elided from file (not left with # symbol)
 - normal screen output (start notification, shell commands, success notification)
 - rsnapshot log shows same as monitor output, no rsync log output

2 Explicitly add in default settings to the rsnapshot.conf file  
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha  && /root/scripts/marklogs.sh #--> rsnapshot.conf modifed as shown:
 rsync_short_args        -a
 rsync_long_args         --delete --numeric-ids --relative --delete-excluded
  - same as previous 

3 change rsync_long_args
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha  && /root/scripts/marklogs.sh #--> rsnapshot.conf modifed from default as shown:
 rsync_short_args        -a
 rsync_long_args         --chmod D0770,F0660 --delete --relative --delete-excluded --partial --log-file=/var/log/rsync-test
 - console shows expected output (start notification, shell commands, success confirmations)
 - rsnapshot log shows same as monitor output
 - rsync log shows building file list, files xferred, sent/received/total summary line for each backup point
 
4 change rsync_short args
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha && /root/scripts/marklogs.sh  #--> rsnapshot.conf modifed from default as shown:
 rsync_short_args        -rlt
 rsync_long_args         --chmod D0770,F0660 --delete --relative --delete-excluded --partial --log-file=/var/log/rsync-test
 - normal console output (start notification, shell commands, success notification)
 - rsnapshot log shows same as console
 - rsync log shows building file list, files xferred, sent/received/total summary line for each backup point

5 change rsync_short_arg to add -v
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha && /root/scripts/marklogs.sh  #--> rsnapshot.conf modifed from default as shown:
 rsync_short_args        -rltv
 rsync_long_args         --chmod D0770,F0660 --delete --relative --delete-excluded --partial --log-file=/var/log/rsync-test
 - console shows the unexpected (and undesired), given verbose set at 2, rsync output
 - rsnapshog log is polluted with rsync output, shows the start notification & shell commands before the noise, then some closing shell commands (touch /obopool/tester/alpha.0/; rm -f /var/run/rsnapshot.pid) then the completion notification
 - rsync log adds one line, "total size ..... speedup is .....", to logged info.
  
6 change loglevel to 1 to see effect on rsnapshot log
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha && /root/scripts/marklogs.sh  #--> rsnapshot.conf modifed from default as shown:
 loglevel                  1
 rsync_short_args        -rltv
 rsync_long_args         --chmod D0770,F0660 --delete --relative --delete-excluded --partial --log-file=/var/log/rsync-test
 - console shows same polluted output (rsnapshot shell commands with rsync data)
 - rsnapshot log received no ouput
 - rsync log shows same (correct) output as previous execution

7 change verbose to 1 (quiet) in rsnapshot.conf
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha && /root/scripts/marklogs.sh  #--> rsnapshot.conf modifed as shown:
 verbose                 1
 loglevel                  1
 rsync_short_args        -rltv
 rsync_long_args         --chmod D0770,F0660 --delete --relative --delete-excluded --partial --log-file=/var/log/rsync-test
 - console - no change to output from test 6 
 - rsnapshot log received no ouput (expected with loglevel 1)
 - rsync log shows expected output (same as previous)

8 set loglevel to 2 to verify effect on rsnapshot log
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha && /root/scripts/marklogs.sh  #--> rsnapshot.conf modifed as shown:
 verbose                 1
 loglevel                  2
 rsync_short_args        -rltv
 rsync_long_args         --chmod D0770,F0660 --delete --relative --delete-excluded --partial --log-file=/var/log/rsync-test
 - console - no change
 - rshapshot log shows only start and completion notices (no shell commands). One assumes errors would show up.
 - rsync log shows expected output

9 variation on 4: default verbose/log level - no -v on rsync_short_args, and add --stats to rsync long args
rm -rf  /obopool/tester/alpha* && rsnapshot -v alpha && /root/scripts/marklogs.sh  #--> rsnapshot.conf modifed from default as shown:
 rsync_short_args        -rlt
 rsync_long_args         --chmod D0770,F0660 --delete --relative --delete-excluded --partial --log-file=/var/log/rsync-test --stats
 - console has stats (rsync) information mixed in with correct output (start notification, shell commands, success confirmations)
 - rshapshot log has the same issues as console: stats output mixed in with  expected output (start notification, shell commands, success confirmations)
 - rsync log shows expected output -- files plus stats.

This is the default (installed) /usr/local/etc/rsnapshot.conf file, against which all the logged changes were made.

#/usr/local/etc/rsnapshot.conf
#################################################
# rsnapshot.conf - rsnapshot configuration file #
#################################################
#                                               #
# PLEASE BE AWARE OF THE FOLLOWING RULE:        #
#                                               #
# This file requires tabs between elements      #
#                                               #
#################################################

#######################
# CONFIG FILE VERSION #
#######################

config_version  1.2
snapshot_root   /obopool/tester
no_create_root  1
cmd_rm          /bin/rm
cmd_rsync       /usr/local/bin/rsync
cmd_logger      /usr/bin/logger
#cmd_rsnapshot_diff     /usr/local/bin/rsnapshot-diff

retain  alpha   6
retain  beta    7
retain  gamma   4
#retain delta   3

# Verbose level, 1 through 5.
# 1     Quiet           Print fatal errors only
# 2     Default         Print errors and warnings only
# 3     Verbose         Show equivalent shell commands being executed
# 4     Extra Verbose   Show extra verbose information
# 5     Debug mode      Everything
#
verbose         2

# Same as "verbose" above, but controls the amount of data sent to the
# logfile, if one is being used. The default is 3.
#
loglevel        3

logfile /var/log/rsnapshot-test
lockfile        /var/run/rsnapshot.pid


###############################
### BACKUP POINTS / SCRIPTS ###
###############################

# LOCALHOST
backup  /root/          localhost/
backup  /etc/           localhost/
backup  /usr/local/     localhost/
backup  /var/log/       localhost/

and finally, here's a bit of the perl -V output

perl -V
Summary of my perl5 (revision 5 version 32 subversion 1) configuration:
   
  Platform:
    osname=freebsd
    osvers=12.2-release-p10
    archname=amd64-freebsd-thread-multi
    uname='freebsd 122amd64-quarterly-job-03 12.2-release-p10 freebsd 12.2-release-p10 amd64 '
    config_args='-Darchlib=/usr/local/lib/perl5/5.32/mach -Dcc=cc -Dcf_by=mat [email protected] -Dcf_time=Sat Jan 23 14:56:40 UTC 2021 -Dinc_version_list=none -Dlibperl=libperl.so.5.32.1 -Dman1dir=/usr/local/lib/perl5/5.32/perl/man/man1 -Dman3dir=/usr/local/lib/perl5/5.32/perl/man/man3 -Dprefix=/usr/local -Dprivlib=/usr/local/lib/perl5/5.32 -Dscriptdir=/usr/local/bin -Dsitearch=/usr/local/lib/perl5/site_perl/mach/5.32 -Dsitelib=/usr/local/lib/perl5/site_perl -Dsiteman1dir=/usr/local/lib/perl5/site_perl/man/man1 -Dsiteman3dir=/usr/local/lib/perl5/site_perl/man/man3 -Dusenm=n -Duseshrplib -sde -Ui_iconv -Ui_malloc -Uinstallusrbinperl -Accflags=-DUSE_THREAD_SAFE_LOCALE -Alddlflags=-L/wrkdirs/usr/ports/lang/perl5.32/work/perl-5.32.1 -L/usr/local/lib/perl5/5.32/mach/CORE -lperl -Dshrpldflags=$(LDDLFLAGS:N-L/wrkdirs/usr/ports/lang/perl5.32/work/perl-5.32.1:N-L/usr/local/lib/perl5/5.32/mach/CORE:N-lperl) -Wl,-soname,$(LIBPERL:R) -Doptimize=-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Dusedtrace -Ui_gdbm -Dusemultiplicity=y -Duse64bitint -Dusemymalloc=n -Dusethreads=y'
0

1 Answer 1

0

It looks like you've got rsync -v. Remove the -v and rsync will become a lot quieter.

You can check this by looking initially at the values for rsync_short_args and possibly rsync_long_args; here are examples from on of my configurations:

rsync_short_args    -azHS
rsync_long_args     --delete --delete-excluded --numeric-ids --fake-super

If you omit these values you're relying on the default staying unchanged. The changelog for rsnapshot should declare if the default has changed, but by using your own definition you bypass that issue completely.

1
  • "Remove the -v and rsync will become a lot quieter." --> that's problem. I want the rsync output. Just not in my rsnapshot logs. I accepted the trade-off of not having the rsync logging in order to have readable rsnapshot logs. After more than a decade of having both.
    – BISI
    Commented Nov 27, 2021 at 6:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .