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

This is a discussion on How to get log file for rsync operation? Does rsync also delete remote files? - Networking ; 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 ...

+ Reply to Thread
Results 1 to 11 of 11

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

  1. 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

  2. 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

  3. Re: How to get log file for rsync operation? Does rsync also delete remote files?

    In comp.os.linux.misc 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?


    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.

  4. 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.


  5. 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

  6. 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



  7. 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/

  8. 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

  9. 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/



  10. 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/

  11. Lightbulb Re: How to get log file for rsync operation? Does rsync also delete remote files?

    Quote Originally Posted by unix View Post
    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.
    Goran
    You may be interested in LBackup for the backup of your server : http://www.lbackup.org.

+ Reply to Thread