How do you get rsync to output a log file - don't understand the MAN pages sorry

Hi There,


Just trying to backup our web hosting server using rsync but can't figure out how to add a log file.


The MAN pages say to use the following syntax:


rsync -av --rsync-path="rsync --log-file=/tmp/rlog" src/ dest/



But when I add that log command into my call like this:


rsync -avz -e --rsync-path="rsync --log-file=/Users/username/rsync.log" ssh user@server:/home/ /Volumes/ServerVolume/webserver-backups/LIVE/home/


I get errors and the command won't run - obviously my syntax is wrong somehow.



Does anyone know how to add a log file to an rsync command?


Any help would be much appreciated.

Posted on Jul 11, 2011 5:38 PM

Reply
4 replies

Jul 11, 2011 8:08 PM in response to Ben Sciascia

If that second example is your specific entry then the answer is obvious.


You need to more closely follow your quotes. All quotes have to be balanced (meaning that whenever you open a set of quotes there needs to be a matching close quote).


In your case you state:


rsync -avz -e --rsync-path="rsync --log-file=/Users/username/rsync.log"


Note how your quotes are arranged... you're telling rsync that --rsync-path is "rsync --log-file=/Users/username/rsync.log", and there's no surprise that it fails.


The correct format for this would be more like:


rsync -avz -e --rsync-path="rsync" --log-file="/Users/username/rsync.log"


(although I also question the validity of the --rsync-path command... are you sure that's right? because I'm not.


Beyond that, though, the file arguments are incorrect - or, at least, there's a superflous 'ssh' command that's snuck its way in there somehow...

Feb 22, 2014 12:05 PM in response to Camelot

Camelot was right, you do not need "--rsync-path" to output a log-file of rsync's acitivity.

use something like:

rsync -avz -e path/to/source path/to/destination--log-file=/Users/username/rsync.log

No need to use quotes, Terminal escapes a space putting "\ " before a file-path containing spaces, e. g. "Your data" will be escaped as "Your\ data" automatically when you drag and drop the destination folder for the log from a Finder window to the Terminal window (=shell).


Message was edited by: tomasio

Oct 31, 2015 10:34 PM in response to Ben Sciascia

I know this post is way old but I came across it when I had the same issue and was searching for a solution. As soon as I added the --log-file=/path/rsync.log command to my rsync command it crapped out and did not produce the log file, let alone run the sync.


Your example:

rsync -avz -e --rsync-path="rsync --log-file=/Users/username/rsync.log" ssh user@server:/home/ /Volumes/ServerVolume/webserver-backups/LIVE/home/

I was using ssh as well and found that moving the "-e" to directly before "ssh" ( -e ssh user@....) was the answer.

My example: sudo rsync -aE --delete --log-file=/path/rsync.log -e ssh User@Server:/Source/Path/Folder "/Destination/path/Folder/"

I also had an issue creating the log file on an external drive so resorted to putting it in the user's desktop folder that was running the rsync which happens to be root.

This is working like a charm.

Thought I would post this for anyone having the same issue. I am running Mac OS X 10.10.5 (Yosemite).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do you get rsync to output a log file - don't understand the MAN pages sorry

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.