How to get log file for rsync operation? Does rsync also delete remote files?

This is a discussion on How to get log file for rsync operation? Does rsync also delete remote files? within the Linux Networking forums, part of the Linux Forums category; I am planning to use rsync for a daily backup to a remote backup server. When I read the rsync ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 1 Week Ago
Goran Ivanic
 
Posts: n/a
Default How to get log file for rsync operation? Does rsync also delete remote files?

I am planning to use rsync for a daily backup to a remote backup server.

When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.

I am missing options like:

rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......

Did I miss these options?

I want to write (append !!) to the log file:

- Which files were transferred
- When the rsync operation took place
- How much bytes were transferred (total sum) in the rsync operation

How can I get such a log file otherwise?

BTW: Does rsync delete remote files (from previous rsync operations) if they are not existing
any more on the source system ?

Goran
Reply With Quote
  #2 (permalink)  
Old 1 Week Ago
Martin Klar
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also deleteremote files?

Goran Ivanic schrieb:
> I am planning to use rsync for a daily backup to a remote backup server.
>
> When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.
>
> I am missing options like:
>
> rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......


maybe you are looking for

--log-file=FILE log what we're doing to the specified FILE

See man rsync.

Martin
Reply With Quote
  #3 (permalink)  
Old 1 Week Ago
Michael Heiming
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also delete remote files?

In comp.os.linux.misc Goran Ivanic <goran@lycos.com> wrote:
> I am planning to use rsync for a daily backup to a remote backup server.


> When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.


> I am missing options like:


> rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......


> Did I miss these options?


Looks like you didn't RTFM?

--log-file=FILE
--log-file-format=FORMAT

> I want to write (append !!) to the log file:


> - Which files were transferred


Is send by rsync to stdout.

> - When the rsync operation took place


Simply add a time stamp to your logfile, or see what above
"--log-file" can do for you, i have never used it.

> - How much bytes were transferred (total sum) in the rsync operation


Is send by rsync to stdout.

> How can I get such a log file otherwise?


Redirect stdout + stderr to your logfile and add a time stamp
prior to firing up rsync or see what "--log-file" can do for you.

> BTW: Does rsync delete remote files (from previous rsync operations) if they are not existing
> any more on the source system ?


Yep, using "--delete" as pointed out in the man page. Something
like the following should do the trick (untested):

rsync -avz --delete /source /destination 2>&1 >> $logfile

I left adding the time stamp as experiment for you.

Good luck

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 353: Second-system effect.
Reply With Quote
  #4 (permalink)  
Old 1 Week Ago
Dan Stromberg
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also deleteremote files?

On Sun, 04 May 2008 07:33:43 +0000, Goran Ivanic wrote:

> I am planning to use rsync for a daily backup to a remote backup server.
>
> When I read the rsync manual it does not become clear on how to write a
> log file for the rsync operation.
>
> I am missing options like:
>
> rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......
>
> Did I miss these options?
>
> I want to write (append !!) to the log file:
>
> - Which files were transferred
> - When the rsync operation took place - How much bytes were transferred
> (total sum) in the rsync operation
>
> How can I get such a log file otherwise?
>
> BTW: Does rsync delete remote files (from previous rsync operations) if
> they are not existing any more on the source system ?
>
> Goran


rsync -avpl --progress --stats should be pretty close to what you want.

Reply With Quote
  #5 (permalink)  
Old 1 Week Ago
lihao0129@gmail.com
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also deleteremote files?

On May 4, 2:33 am, go...@lycos.com (Goran Ivanic) wrote:
> I am planning to use rsync for a daily backup to a remote backup server.
>
> When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.
>
> I am missing options like:
>
> rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......
>
> Did I miss these options?
>
> I want to write (append !!) to the log file:
>
> - Which files were transferred
> - When the rsync operation took place
> - How much bytes were transferred (total sum) in the rsync operation
>
> How can I get such a log file otherwise?


what *nix box are you using? I have rsync under Ubuntu and RHEL5, and
they use very different ways to handle logfile:

for Ubuntu, I use:

rsync -aqC --delete -i --log-file=/var/log/mytest.log SRC DEST
2>&1 1>/dev/null

(logfile are in append mode automatically. at least for my server)

for RHEL5:

rsync -i --delete -avC SRC DEST 1>>/var/log/mytest.log 2>/dev/null

> BTW: Does rsync delete remote files (from previous rsync operations) if they are not existing
> any more on the source system ?


use --delete option, old files which are not on SRC will be removed
from the DESC.

lihao
Reply With Quote
  #6 (permalink)  
Old 1 Week Ago
Moody
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also deleteremote files?

On May 4, 12:33 pm, go...@lycos.com (Goran Ivanic) wrote:
> I am planning to use rsync for a daily backup to a remote backup server.
>
> When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.
>
> I am missing options like:
>
> rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......
>
> Did I miss these options?
>
> I want to write (append !!) to the log file:
>
> - Which files were transferred
> - When the rsync operation took place
> - How much bytes were transferred (total sum) in the rsync operation


Possibly:

rsync -auvz -e ssh server:/path/source server:/destination/path >>
your custom-Logs file

other wise U may use sometime like below:
rsync -auvz --log-format=FORMAT -e ssh server:/path/source server:/
destination/path

where you may specify the log-format in your rsyncd.conf if you are
running a rsyncd ( daemon ) ( I never tried this, as I've been using
STDOUT option ^ Above ^ for logging the statistics of file
transfers...

Hope this helps..

Regards,




>
> How can I get such a log file otherwise?
>
> BTW: Does rsync delete remote files (from previous rsync operations) if they are not existing
> any more on the source system ?
>
> Goran


Reply With Quote
  #7 (permalink)  
Old 1 Week Ago
Todd H.
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also delete remote files?

goran@lycos.com (Goran Ivanic) writes:
> I am planning to use rsync for a daily backup to a remote backup server.
>
> When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.
>
> I am missing options like:
>
> rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......
>
> Did I miss these options?
>
> I want to write (append !!) to the log file:
>
> - Which files were transferred
> - When the rsync operation took place
> - How much bytes were transferred (total sum) in the rsync operation
>
> How can I get such a log file otherwise?


First, I'm not sure you cross posted to enough newsgroups.


You can redirect stderr and stdout to a logfile.

rsync blah blah 2>&1 >> mylogfile.txt

> BTW: Does rsync delete remote files (from previous rsync operations) if they are not existing
> any more on the source system ?


It can, if you specify the --delete option. See man rsync for more.

--
Todd H.
http://www.toddh.net/
Reply With Quote
  #8 (permalink)  
Old 1 Week Ago
Scott McMillan
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also delete remote files?

On 04 May 2008 07:33:43 GMT, goran@lycos.com (Goran Ivanic) wrote:

>I am planning to use rsync for a daily backup to a remote backup server.
>
>When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.
>
>I am missing options like:
>
>rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......
>
>Did I miss these options?
>
>I want to write (append !!) to the log file:
>
>- Which files were transferred
>- When the rsync operation took place
>- How much bytes were transferred (total sum) in the rsync operation
>
>How can I get such a log file otherwise?


With simple redirection:
rsync (your options) >>yourlogfile 2>&1

>
>BTW: Does rsync delete remote files (from previous rsync operations) if they are not existing
>any more on the source system ?


It can. See the --delete option(s) in the man page.



Scott McMillan
Reply With Quote
  #9 (permalink)  
Old 1 Week Ago
Guillaume Dargaud
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also delete remote files?

> How can I get such a log file otherwise?

rsync ... >> logfile
is good enough for me. Or:
--log-file=FILE log what we're doing to the specified FILE
--log-file-format=FMT log updates using the specified FMT

> BTW: Does rsync delete remote files (from previous rsync operations) if
> they are not existing
> any more on the source system ?


--delete delete extraneous files from dest dirs
--
Guillaume Dargaud
http://www.gdargaud.net/


Reply With Quote
  #10 (permalink)  
Old 1 Week Ago
John Murtari
 
Posts: n/a
Default Re: How to get log file for rsync operation? Does rsync also deleteremote files?

goran@lycos.com (Goran Ivanic) writes:

> I am planning to use rsync for a daily backup to a remote backup server.
>
> When I read the rsync manual it does not become clear on how to write a log file for the rsync operation.
>
> I am missing options like:
>
> rsync ..... -logfile=\home\backup\rsync.log -logmode=append ......
>
> Did I miss these options?
>
> I want to write (append !!) to the log file:
>
> - Which files were transferred
> - When the rsync operation took place
> - How much bytes were transferred (total sum) in the rsync operation
>
> How can I get such a log file otherwise?
>
> BTW: Does rsync delete remote files (from previous rsync operations) if they are not existing
> any more on the source system ?


You really should take some time and look at a good 'man' page on
rsync. Everything you want is supported, here a few starter options:

-v, --verbose
This option increases the amount of information you are given during the transfer. By default, rsync works
silently. A single -v will give you information about what files are being transferred and a brief summary at
the end. Two -v flags will give you information on what files are being skipped and slightly more information
at the end. More than two -v flags should only be used if you are debugging rsync.

--delete
This tells rsync to delete any files on the receiving side that aren’t on the sending side. Files that are
excluded from transfer are excluded from being deleted unless you use --delete-excluded.

--log-format=FORMAT
This allows you to specify exactly what the rsync client logs to stdout on a per-file basis. The log format
is specified using the same format conventions as the log format option in rsyncd.conf.


Hope this helps!
--
John
__________________________________________________ _________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:57 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0