Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
b6062654
Commit
b6062654
authored
Nov 03, 1998
by
Andrew Tridgell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the --log-format option to allow users to request arbitrary
per-file logging of interactive rsync sessions.
parent
263cf2ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
7 deletions
+37
-7
log.c
log.c
+22
-6
options.c
options.c
+8
-1
rsync.yo
rsync.yo
+6
-0
rsyncd.conf.yo
rsyncd.conf.yo
+1
-0
No files found.
log.c
View file @
b6062654
...
...
@@ -174,7 +174,8 @@ void rflush(int fd)
/* a generic logging routine for send/recv, with parameter
substitiution */
static
void
log_formatted
(
char
*
op
,
struct
file_struct
*
file
,
static
void
log_formatted
(
int
fd
,
char
*
format
,
char
*
op
,
struct
file_struct
*
file
,
struct
stats
*
initial_stats
)
{
extern
int
module_id
;
...
...
@@ -187,7 +188,7 @@ static void log_formatted(char *op, struct file_struct *file,
extern
int
am_sender
;
int64
b
;
strlcpy
(
buf
,
lp_log_format
(
module_id
)
,
sizeof
(
buf
)
-
1
);
strlcpy
(
buf
,
format
,
sizeof
(
buf
)
-
1
);
for
(
s
=&
buf
[
0
];
s
&&
(
p
=
strchr
(
s
,
'%'
));
)
{
...
...
@@ -214,8 +215,10 @@ static void log_formatted(char *op, struct file_struct *file,
f_name
(
file
));
clean_fname
(
buf2
);
n
=
buf2
;
if
(
*
n
==
'/'
)
n
++
;
break
;
case
'm'
:
n
=
lp_name
(
module_id
);
break
;
case
't'
:
n
=
timestring
(
time
(
NULL
));
break
;
case
'P'
:
n
=
lp_path
(
module_id
);
break
;
case
'u'
:
n
=
auth_user
;
break
;
case
'b'
:
...
...
@@ -260,15 +263,20 @@ static void log_formatted(char *op, struct file_struct *file,
s
=
p
+
l
;
}
rprintf
(
FLOG
,
"%s
\n
"
,
buf
);
rprintf
(
fd
,
"%s
\n
"
,
buf
);
}
/* log the outgoing transfer of a file */
void
log_send
(
struct
file_struct
*
file
,
struct
stats
*
initial_stats
)
{
extern
int
module_id
;
extern
int
am_server
;
extern
char
*
log_format
;
if
(
lp_transfer_logging
(
module_id
))
{
log_formatted
(
"send"
,
file
,
initial_stats
);
log_formatted
(
FLOG
,
lp_log_format
(
module_id
),
"send"
,
file
,
initial_stats
);
}
else
if
(
log_format
&&
!
am_server
)
{
log_formatted
(
FINFO
,
log_format
,
"send"
,
file
,
initial_stats
);
}
}
...
...
@@ -276,8 +284,13 @@ void log_send(struct file_struct *file, struct stats *initial_stats)
void
log_recv
(
struct
file_struct
*
file
,
struct
stats
*
initial_stats
)
{
extern
int
module_id
;
extern
int
am_server
;
extern
char
*
log_format
;
if
(
lp_transfer_logging
(
module_id
))
{
log_formatted
(
"recv"
,
file
,
initial_stats
);
log_formatted
(
FLOG
,
lp_log_format
(
module_id
),
"send"
,
file
,
initial_stats
);
}
else
if
(
log_format
&&
!
am_server
)
{
log_formatted
(
FINFO
,
log_format
,
"send"
,
file
,
initial_stats
);
}
}
...
...
@@ -296,7 +309,10 @@ void log_exit(int code)
}
/* log the incoming transfer of a file for interactive use, this
will be called at the end where the client was run */
will be called at the end where the client was run
it i called when a file starts to be transferred
*/
void
log_transfer
(
struct
file_struct
*
file
,
char
*
fname
)
{
extern
int
verbose
;
...
...
options.c
View file @
b6062654
...
...
@@ -67,6 +67,7 @@ char *tmpdir = NULL;
char
*
compare_dest
=
NULL
;
char
*
config_file
=
RSYNCD_CONF
;
char
*
shell_cmd
=
NULL
;
char
*
log_format
=
NULL
;
char
*
rsync_path
=
RSYNC_NAME
;
int
rsync_port
=
RSYNC_PORT
;
...
...
@@ -132,6 +133,7 @@ void usage(int F)
rprintf
(
F
,
" --port=PORT specify alternate rsyncd port number
\n
"
);
rprintf
(
F
,
" --stats give some file transfer stats
\n
"
);
rprintf
(
F
,
" --progress show progress during transfer
\n
"
);
rprintf
(
F
,
" --log-format=FORMAT log file transfers using specified format
\n
"
);
rprintf
(
F
,
" -h, --help show this help screen
\n
"
);
rprintf
(
F
,
"
\n
"
);
...
...
@@ -146,7 +148,7 @@ enum {OPT_VERSION,OPT_SUFFIX,OPT_SENDER,OPT_SERVER,OPT_EXCLUDE,
OPT_EXCLUDE_FROM
,
OPT_DELETE
,
OPT_NUMERIC_IDS
,
OPT_RSYNC_PATH
,
OPT_FORCE
,
OPT_TIMEOUT
,
OPT_DAEMON
,
OPT_CONFIG
,
OPT_PORT
,
OPT_INCLUDE
,
OPT_INCLUDE_FROM
,
OPT_STATS
,
OPT_PARTIAL
,
OPT_PROGRESS
,
OPT_SAFE_LINKS
,
OPT_COMPARE_DEST
};
OPT_SAFE_LINKS
,
OPT_COMPARE_DEST
,
OPT_LOG_FORMAT
};
static
char
*
short_options
=
"oblLWHpguDCtcahvrRIxnSe:B:T:z"
;
...
...
@@ -198,6 +200,7 @@ static struct option long_options[] = {
{
"partial"
,
0
,
0
,
OPT_PARTIAL
},
{
"config"
,
1
,
0
,
OPT_CONFIG
},
{
"port"
,
1
,
0
,
OPT_PORT
},
{
"log-format"
,
1
,
0
,
OPT_LOG_FORMAT
},
{
0
,
0
,
0
,
0
}};
...
...
@@ -419,6 +422,10 @@ int parse_arguments(int argc, char *argv[])
rsync_port
=
atoi
(
optarg
);
break
;
case
OPT_LOG_FORMAT
:
log_format
=
optarg
;
break
;
default:
return
0
;
}
...
...
rsync.yo
View file @
b6062654
...
...
@@ -254,6 +254,7 @@ Options
--port=PORT specify alternate rsyncd port number
--stats give some file transfer stats
--progress show progress during transfer
--log-format=FORMAT log file transfers using specified format
-h, --help show this help screen
)
...
...
@@ -549,6 +550,11 @@ specified.
dit(bf(--port PORT)) This specifies an alternate TCP port number to use
rather than the default port 873.
dit(bf(--log-format=FORMAT)) Normally rsync just logs filenames as
they are transferred. This allows you to specify exactly what gets
logged on a per file basis. The log format is specified using the same
format conventions as the log format option in rsyncd.conf.
dit(bf(--stats)) This tells rsync to print a verbose set of statistics
on the file transfer, allowing you to tell how effective the rsync
algorithm is for your data. This option only works in conjunction with
...
...
rsyncd.conf.yo
View file @
b6062654
...
...
@@ -128,6 +128,7 @@ itemize(
it() %f for the filename
it() %P for the module path
it() %m for the module name
it() %t for the current time
it() %u for the authenticated username (or the null string)
it() %b for the number of bytes actually transferred
it() %c when sending files this gives the number of checksum bytes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment