7

I'm using rsnapshot (which use rsync) to backup files from my web server to local Linux box (Synology)

Files, deleted on the web server are deleted on the Linux box, as expected. The problem, that info about deleted files are not logged. How can I add list of deleted files to the rsync log?

Here are rsync parameters in the rsnapshot.conf:

rsync_short_args -av
rsync_long_args --out-format="%t %f %b" --delete --delete-excluded \
    --log-file=/volume1/web/logs/rsn_sync.log --copy-links

So this results in following command:

/usr/syno/bin/rsync -av --out-format="%t %i %f %b" --delete --delete-excluded \

    --log-file=/volume1/web/logs/rsn_sync.log --copy-links \
    --exclude-from=/volume1/web/BK/exclude.txt --rsh=/usr/syno/bin/ssh \
    --link-dest=/volume1/web/BK2/weekly.1/slavikF/ \
    root@slavikf.com:/var/www/ /volume1/web/BK2/weekly.0/slavikF/
guntbert
  • 1,637
Slavik
  • 201
  • Do you get something in the output when you run the command about the deleted files? If that is the case, why you don't just redirect the output to a file? – VaTo May 17 '15 at 02:28
  • 2
    After many trials, I found:
    • flag "--itemize-changes" doesn't affect anything. There are no info about deleted files IN THE LOG. Seems to be the bug of rsync. I have version 3.09

    • But information about deleted files is present in the console output (regardless of --itemize-changes).

    • I can't get console output, when using rsync from rsnapshot.

    • But I can use rsnapshot diff, which does, what I need to do.

    – Slavik May 17 '15 at 07:07
  • You could use luckyBackup which is a GUI tool for rsync. It not only keeps logs but also can save the old deleted data as versions. – shivams May 17 '15 at 10:57
  • Any update on this issue? It is still not showing the delete folders/files in the log – jlanza Dec 03 '19 at 09:34
  • @jlanza I've answered an old question you commented on. If you are still interested, please check it out! – bitsmack May 06 '21 at 07:04
  • I also believe this is a rsync bug, which has been there for more than 10 yrs :( https://lists.samba.org/archive/rsync/2013-October/028768.html – Arnie97 Mar 17 '22 at 15:54

3 Answers3

3
-i, --itemize-changes      output a change-summary for all updates
Also:  -v, --verbose              increase verbosity
VaTo
  • 3,101
  • 1
    Note: if you use --link-dest, deleted files will not be listed. This is true for all the answers to this question.

    https://rsync.samba.narkive.com/9lakR0U3/

    – nicbou Mar 25 '21 at 10:32
1

An old question, but here's the answer:

When used on a single system, rsync spins up two processes: once which is considered "local" (and sends data from the source directory) and once which is "remote" (which receives the data).

The deletions are handled on the remote side, not the local side.

The default log is created by the "local" process and doesn't show the deleted file:

$ rsync -a --delete-during --log-file=~/rsynclog.log src/ dest
$ cat ~/rsynclog.log
2021/05/05 23:51:09 [4244] building file list
2021/05/05 23:51:09 [4244] .d..t...... {directory}

But, you can cause the "remote" side to create the log. Then the deletion shows up!

$ rsync -a --delete-during --remote-option=--log-file=~/rsynclog.log src/ dest
$ cat ~/rsynclog.log
2021/05/05 23:39:18 [31138] receiving file list
2021/05/05 23:39:18 [31138] *deleting   {directory}/{filename}
2021/05/05 23:39:18 [31138] .d..t...... {directory}
bitsmack
  • 205
  • 3
  • 13
-1

The documentation says --log-file-format use %i %n%L by default.

You can use %o here. The documentation says:

%o the operation, which is "send", "recv", or "del." (the latter includes the trailing period)

So, what you are basically looking for is:

--log-file-format='%i %n%L %o' 
Ahmad Ismail
  • 2,678