0

I am working to implement a log backup solution which is going to rely on using rsync to move data off of a local server and on to a remote logging server. We have two concerns - the first is that as of now I have not implemented any logging which needs to be done. The man page for rsync is huge, and we're not using an rsync server, just an oncall rsync to push data from the client (client initiated) to the storage server.

Off the top of anyones head, are there any logging options for failures mid transfer, or anything like that?

Also, due to the nature of how we are implementing it, the shell script first tries to ping the the local backup server. If the ping is successful, it uploads the files. However, if the ping is unsuccessful, it will instead upload to a georedundant backup server. This leaves a hole if the main server goes down midway through the rsync. Is there any way to specify a backup destination in the case of a failure mid transfer?

1 Answer 1

0

I don't think rsync has any builtin failover options or special error logging (other than what's printed to stderr). It does have --log-file= and --log-file-format= options, but these concentrate on logging what files were updated, not connection failures. What I'd recommend is on the client side, check the exit status of rsync, and if it's an error number that indicates a connection problem (it looks like 10, 12, and 30 are the relevant ones, but testing will give you a better idea) scan for another reachable server and retry. You can also capture rsync's stderr output, and either log that directly or scan it for recognized errors and summarize them in your log.

If you want logging on the server side as well, I'd write a wrapper script that runs rsync normally (rsync "$@" to pass through arguments), then checks its exit status and logs that. Make sure your script doesn't output anything (to stdout or stderr) itself, or it may confuse the remote rsync client.

You must log in to answer this question.

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