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/ \
    [email protected]:/var/www/ /volume1/web/BK2/weekly.0/slavikF/
  • 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
    Commented May 17, 2015 at 2: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
    Commented May 17, 2015 at 7: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
    Commented May 17, 2015 at 10:57
  • Any update on this issue? It is still not showing the delete folders/files in the log
    – jlanza
    Commented Dec 3, 2019 at 9:34
  • @jlanza I've answered an old question you commented on. If you are still interested, please check it out!
    – bitsmack
    Commented May 6, 2021 at 7:04

3 Answers 3

-i, --itemize-changes      output a change-summary for all updates
Also:  -v, --verbose              increase verbosity
  • 1
    Note: if you use --link-dest, deleted files will not be listed. This is true for all the answers to this question. rsync.samba.narkive.com/9lakR0U3
    – nicbou
    Commented Mar 25, 2021 at 10:32

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}

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' 
  • 1
    Did you check that using the suggested option outputs deleted files to the log? I am after the same target as in the OP, and I don't see this works. Please confirm. Commented Jan 24, 2022 at 18:51
  • I was actually not getting any files in the log, since I was using --dry-run. This behaviour is described in unix.stackexchange.com/questions/225849/… Commented Jan 24, 2022 at 19:05
  • I use --info=PROGRESS2,BACKUP,DEL --backup-dir=$(date +"%d-%m-%y_%I-%M-%S%P").bak --log-file-format='%t %f %o %M' and it created a log entry like 2022/01/25 02:39:31 [13251] backed up WDPurple6TB/_Database/_Database/file.txt Commented Jan 24, 2022 at 20:46
  • For the given format the log entry looks like 2022/01/25 02:48:51 [14366] *deleting WDPurple6TB/_BusinessIT/text.txt del. Commented Jan 24, 2022 at 20:53
  • Even with --dry-run? Commented Jan 24, 2022 at 21:14

You must log in to answer this question.

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