TL;DR
是否有一些r快照的配置(请参阅下面的版本),允许我将输出限制为由r快照本身生成的shell命令、错误和启动/完成通知,同时使rsync只在rsync日志文件中生成和记录所需的详细信息级别?或者更简洁地说,我是否可以使r快照输出的结果与r快照配置文件中的详细描述相匹配?
如果没有,是否有接受特性请求的r快照社区?
只有TL部分..。
经过一些故障排除后(见下文),我的r快照和rsync的特定组合不再像过去几年那样工作了。具体来说,rsync的输出现在显示在r快照的控制台输出中,而不考虑rsnapshot.conf中的详细设置。我有一个新的FreeBSD 12.2安装
freebsd-version
12.2-RELEASE-p10rsync是作为pkg install rsnapshot的一部分安装的,rsync -V显示了
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 noneR快照的当前版本是:
my $VERSION = '1.4.4';在发布此问题的原始形式并在其上睡觉之后,再加上前面提到的疑难解答,问题归结为:r快照从crontab运行,控制台输出中出现的不必要的rsync信息(尽管有冗长的1设置)似乎需要一个“包装器”脚本来抑制噪音,然后从r快照日志中组装正确的信息。这似乎是一个非常容易出错的过程,也可能是一个非常高的维护,因为升级打破了管道胶带性质的解决办法。
成本最低的路径似乎是放弃获取任何关于rsync传输有效性的统计信息。这使我能够维护监视rsync的成功/失败的可读性,并且在它确实失败时很容易地重新运行它。
显然,rsync (隐式-v设置?)显然发生了变化,如果有某种配置允许我在r快照输出(只有shell命令、错误和启动/完成通知)记录rsync日志文件中的rsync输出时,我很想知道这一点。
请记住,自2018年以来,r快照机制一直运行得很好,只需要重新安装FreeBSD 12.2就可以破坏它。以前的r快照制度是在升级的FreeBSD 12.1 (从10.x开始)上运行的(在相同的硬件上)。rsync和r快照最初是独立于FreeBSD 10.x端口构建的(按这个顺序),并从那时起定期使用portmaster进行升级。
这一次(如前所述),我用pkg安装了r快照,并让它安装rsync (以及它需要的其他东西)。
rsnapshot.conf仅在snapshot_root值和缩短的备份点列表中更改。
下面是我想要的监控电子邮件的输出(容易处理)(也就是说,没有所有的rsync噪声):
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而不是这样(记住有>20个备份点,许多备份点有数百行不需要的rsync输出):
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来自同一个rsnapshot.conf文件。
这是我一直在做的疑难解答。测试4是我以前的最佳近似值。
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.这是默认(已安装) /usr/local/etc/rsnapshot.conf文件,所有记录的更改都是针对该文件进行的。
#/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/最后,下面是一些perl -V输出
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 -Dcf_email=mat@FreeBSD.org -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'发布于 2021-10-29 08:24:35
看来你有rsync -v了。删除-v和rsync将变得更加安静。
您可以通过最初查看rsync_short_args和可能的rsync_long_args的值来检查这一点;下面是关于我的配置的示例:
rsync_short_args -azHS
rsync_long_args --delete --delete-excluded --numeric-ids --fake-super如果省略这些值,则依赖于默认值保持不变。rsnapshot的changelog应该声明默认值是否已经更改,但是通过使用您自己的定义,您可以完全绕过这个问题。
https://unix.stackexchange.com/questions/675093
复制相似问题