Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to get log file for rsync operation? Does rsync also delete remote files?

Reply
Thread Tools Display Modes

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

 
 
Goran Ivanic
Guest
Posts: n/a

 
      05-04-2008, 07:33 AM
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
 
 
 
 
Martin Klar
Guest
Posts: n/a

 
      05-04-2008, 07:48 AM
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
 
Michael Heiming
Guest
Posts: n/a

 
      05-04-2008, 11:21 AM
In comp.os.linux.misc Goran Ivanic <(E-Mail Removed)> 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 (E-Mail Removed) | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 353: Second-system effect.
 
Reply With Quote
 
Dan Stromberg
Guest
Posts: n/a

 
      05-05-2008, 12:55 AM
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
 
lihao0129@gmail.com
Guest
Posts: n/a

 
      05-05-2008, 04:00 AM
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
 
Moody
Guest
Posts: n/a

 
      05-05-2008, 11:56 AM
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
 
Todd H.
Guest
Posts: n/a

 
      05-05-2008, 12:50 PM
(E-Mail Removed) (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
 
Scott McMillan
Guest
Posts: n/a

 
      05-05-2008, 02:03 PM
On 04 May 2008 07:33:43 GMT, (E-Mail Removed) (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
 
Guillaume Dargaud
Guest
Posts: n/a

 
      05-05-2008, 03:46 PM
> 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
 
John Murtari
Guest
Posts: n/a

 
      05-05-2008, 04:58 PM
(E-Mail Removed) (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$B!G(Bt 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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exclusion of files in rsync with or without wildcards? Matthew Lincoln Linux Networking 3 06-06-2008 10:55 AM
rsync says some files can not be transferred linq936@hotmail.com Linux Networking 1 09-28-2006 09:32 PM
RSync: move 'deleted' files to a specific folder Vincent Lascaux Linux Networking 2 09-11-2006 12:59 PM
rsync *only* files with no namesake on the destination dmorgan1 Linux Networking 1 06-24-2005 11:50 PM
Which is fastest program for copying files over network e.g rcp, ftp, scp, rsync David Travers Linux Networking 7 12-02-2004 11:58 PM



1 2 3 4 5 6 7 8 9 10 11