- gid
- group
- log
+ - log-send-hostname
- nbproc
- pidfile
- uid
emerg alert crit err warning notice info debug
+log-send-hostname [<string>]
+ Sets the hostname field in the syslog header. If optional "string" parameter
+ is set the header is set to the string contents, otherwise uses the hostname
+ of the system. Generally used if one is not relaying logs through an
+ intermediate syslog server or for simply customizing the hostname printed in
+ the logs.
+
nbproc <number>
Creates <number> processes when going daemon. This requires the "daemon"
mode. By default, only one process is created, which is the recommended mode
int loglev1, loglev2;
int minlvl1, minlvl2;
struct logsrv logsrv1, logsrv2;
+ char *log_send_hostname; /* set hostname in syslog header */
struct {
int maxpollevents; /* max number of poll events at once */
int maxaccept; /* max number of consecutive accept() */
err_code |= ERR_ALERT | ERR_FATAL;
}
}
+ else if (!strcmp(args[0], "log-send-hostname")) { /* set the hostname in syslog header */
+ char *name;
+ int len;
+
+ if (global.log_send_hostname != NULL) {
+ Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
+ err_code |= ERR_ALERT;
+ goto out;
+ }
+
+ if (*(args[1]))
+ name = args[1];
+ else
+ name = hostname;
+
+ len = strlen(name);
+
+ /* We'll add a space after the name to respect the log format */
+ free(global.log_send_hostname);
+ global.log_send_hostname = malloc(len + 2);
+ snprintf(global.log_send_hostname, len + 2, "%s ", name);
+ }
else if (!strcmp(args[0], "spread-checks")) { /* random time between checks (0-50) */
if (global.spread_checks != 0) {
Alert("parsing [%s:%d]: spread-checks already specified. Continuing.\n", file, linenum);
protocol_unbind_all();
+ free(global.log_send_hostname); global.log_send_hostname = NULL;
free(global.chroot); global.chroot = NULL;
free(global.pidfile); global.pidfile = NULL;
free(global.node); global.node = NULL;
get_localtime(tvsec, &tm);
hdr_len = snprintf(logmsg, sizeof(logmsg),
- "<<<<>%s %2d %02d:%02d:%02d %s[%d]: ",
+ "<<<<>%s %2d %02d:%02d:%02d %s%s[%d]: ",
monthname[tm.tm_mon],
tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
+ global.log_send_hostname ? global.log_send_hostname : "",
progname, pid);
/* WARNING: depending upon implementations, snprintf may return
* either -1 or the number of bytes that would be needed to store