Where does rsync keep the log file for complete and incomplete data transfers?

96,051

Solution 1

I do the job in perl (in command line):

# perl -ne '
    ($conn{$2}->{"ip"},$conn{$2}->{"started"})=($3,$1) if 
        /^(.{15}).*rsyncd\[(\d+)\]:\sconnect.*\((\d+\.\d+\.\d+\.\d+)\)/;
    $conn{$2}->{"closed"}=$1 if /(.{15}).*rsyncd\[(\d+)\]:\ssent\s.*\stotal/;
    END {
        print "Good:\n";
        map{
            printf "%s %-16s %s\n",
                $conn{$_}->{"started"},$conn{$_}->{"ip"},$conn{$_}->{"closed"} if
                    $conn{$_}->{"closed"};
          } sort { $conn{$a}->{"started"} cmp $conn{$b}->{"started"}
          } keys %conn;
        print "Unterminated:\n";
        map{
            printf "%s %s\n",$conn{$_}->{"started"},$conn{$_}->{"ip"};
          } sort { $conn{$a}->{"started"} cmp $conn{$b}->{"started"}
          } grep { ! defined $conn{$_}->{"closed"}
          } keys %conn;
    }' < /var/log/daemon.log

This could produce outputs like:

Good:
Apr 28 08:12:01 127.0.0.1        Apr 28 08:15:35
Apr 28 08:27:01 192.168.1.36     Apr 28 08:28:04
Apr 28 08:42:01 127.0.0.1        Apr 28 08:42:13
Apr 28 08:57:01 192.168.1.36     Apr 28 08:57:16
Apr 28 09:12:01 127.0.0.1        Apr 28 09:12:28
Apr 28 09:27:01 192.168.1.36     Apr 28 09:27:13
Apr 28 09:42:01 127.0.0.1        Apr 28 09:42:09
Apr 28 09:57:02 192.168.1.36     Apr 28 09:57:16
Apr 28 10:12:01 127.0.0.1        Apr 28 10:12:32
Apr 28 10:27:01 192.168.1.36     Apr 28 10:27:12
Apr 28 10:42:01 127.0.0.1        Apr 28 10:42:14
Apr 28 10:57:01 192.168.1.36     Apr 28 10:57:13
Apr 28 11:27:01 192.168.1.36     Apr 28 11:28:01
Apr 28 11:42:01 127.0.0.1        Apr 28 11:44:32
Apr 28 11:57:02 192.168.1.36     Apr 28 11:58:43
Apr 28 12:12:01 127.0.0.1        Apr 28 12:12:27
Apr 28 12:27:01 192.168.1.36     Apr 28 12:28:48
Apr 28 12:42:01 127.0.0.1        Apr 28 12:42:13
Apr 28 12:57:01 192.168.1.36     Apr 28 12:57:56
Unterminated:
Apr 28 11:12:01 127.0.0.1

Solution 2

You can say where the log file is (per the man page documentation):

--log-file=FILE         override the "log file" setting

Solution 3

Logs infos are normaly sent via syslog daemon, when rsync run in daemon mode.

If you want to log someting when using rsync over ssh, you have to put option in command line:

rsync --rsync-path='/usr/bin/rsync --log-file=$HOME/.rsyncd.log' -t Desktop/sony.pdf [email protected]:

for saving logs in destination host or

rsync --log-file=$HOME/.rsyncd.log -t Desktop/sony.pdf [email protected]:

for saving logs in source host.

Solution 4

Search for evidence of rsync in the system logs. For example:

sudo grep -ir rsync /var/log

For that matter, you could grep / though that is overkill.

Share:
96,051
user1709815
Author by

user1709815

Updated on July 09, 2022

Comments

  • user1709815
    user1709815 almost 2 years

    I want to get the IPs of all the destination devices where my data transfer using rsync could not be complete (or even start) as those devices are not connected to Internet or got disconnected while data transfer ...


    My actual problem scenario is :

    rsync -t Desktop/sony.pdf [email protected]: ssh: connect to host a.b.c.d port 22: No route to host

    and I want the list of all such IPs where the data transfer could not be complted ...

    the list of all IPs like 'a.b.c.d '

  • user1709815
    user1709815 over 11 years
    Thanks for your answer. but i am not having any file inside as deamon.log inside /var/log !!
  • Juampa
    Juampa over 10 years
    What Linux distribution have you tested that? I get -> rsync: --log-file=/root/.rsyncd.log: unknown option
  • kbulgrien
    kbulgrien over 10 years
    The feature was added in rsync version 2.6.9 (6 Nov 2006). You can see the change log at: rsync.samba.org/ftp/rsync/src/rsync-2.6.9-NEWS As the change is so old, I would think that most any distribution that is up to date would have this feature. I used Mandriva Enterprise Server which is based on a 2009 release of their free version.
  • Remo Harsono
    Remo Harsono almost 10 years
    remember to use double dash --log-file