char *prexfer_exec;
char *refuse_options;
char *secrets_file;
+ char *syslog_tag;
char *temp_dir;
char *uid;
/* NOTE: update this macro if the last char* variable changes! */
/* prexfer_exec; */ NULL,
/* refuse_options; */ NULL,
/* secrets_file; */ NULL,
+ /* syslog_tag; */ "rsyncd",
/* temp_dir; */ NULL,
/* uid; */ NULL,
{"secrets file", P_STRING, P_LOCAL, &Vars.l.secrets_file, NULL,0},
{"strict modes", P_BOOL, P_LOCAL, &Vars.l.strict_modes, NULL,0},
{"syslog facility", P_ENUM, P_LOCAL, &Vars.l.syslog_facility, enum_facilities,0},
+ {"syslog tag", P_STRING, P_LOCAL, &Vars.l.syslog_tag, NULL,0},
{"temp dir", P_PATH, P_LOCAL, &Vars.l.temp_dir, NULL,0},
{"timeout", P_INTEGER,P_LOCAL, &Vars.l.timeout, NULL,0},
{"transfer logging", P_BOOL, P_LOCAL, &Vars.l.transfer_logging, NULL,0},
FN_LOCAL_STRING(lp_prexfer_exec, prexfer_exec)
FN_LOCAL_STRING(lp_refuse_options, refuse_options)
FN_LOCAL_STRING(lp_secrets_file, secrets_file)
+FN_LOCAL_STRING(lp_syslog_tag, syslog_tag)
FN_LOCAL_STRING(lp_temp_dir, temp_dir)
FN_LOCAL_STRING(lp_uid, uid)
static void syslog_init()
{
- static int been_here = 0;
int options = LOG_PID;
- if (been_here)
- return;
- been_here = 1;
-
#ifdef LOG_NDELAY
options |= LOG_NDELAY;
#endif
#ifdef LOG_DAEMON
- openlog("rsyncd", options, lp_syslog_facility(module_id));
+ openlog(lp_syslog_tag(module_id), options, lp_syslog_facility(module_id));
#else
- openlog("rsyncd", options);
+ openlog(lp_syslog_tag(module_id), options);
#endif
#ifndef LOG_NDELAY
rsyserr(FERROR, fopen_errno,
"failed to open log-file %s", logfile_name);
rprintf(FINFO, "Ignoring \"log file\" setting.\n");
+ logfile_name = "";
}
}
void log_init(int restart)
{
if (log_initialised) {
- if (!restart)
+ if (!restart) /* Note: a restart only happens with am_daemon */
return;
+ assert(logfile_name); /* all am_daemon procs got at least an empty string */
if (strcmp(logfile_name, lp_log_file(module_id)) != 0) {
if (logfile_fp) {
fclose(logfile_fp);
logfile_name = NULL;
} else if (*logfile_name)
return; /* unchanged, non-empty "log file" names */
- else if (lp_syslog_facility(-1) != lp_syslog_facility(module_id))
+ else if (lp_syslog_facility(-1) != lp_syslog_facility(module_id)
+ || strcmp(lp_syslog_tag(-1), lp_syslog_tag(module_id)) != 0)
closelog();
else
return; /* unchanged syslog settings */
syslog_init();
}
+/* Note that this close & reopen idiom intentionally ignores syslog logging. */
void logfile_close(void)
{
if (logfile_fp) {
non-empty string (either set in the per-modules settings, or inherited
from the global settings).
+dit(bf(syslog tag)) This parameter allows you to specify the syslog
+tag to use when logging messages from the rsync daemon. The default is
+"rsyncd". This setting has no effect if the "log file" setting is a
+non-empty string (either set in the per-modules settings, or inherited
+from the global settings).
+
+For example, if you wanted each authenticated user's name to be
+included in the syslog tag, you could do something like this:
+
+verb( syslog tag = rsyncd.%RSYNC_USER_NAME%)
+
dit(bf(max verbosity)) This parameter allows you to control
the maximum amount of verbose information that you'll allow the daemon to
generate (since the information goes into the log file). The default is 1,