I've written a short patch for syslogd that adds a -H option. Setting that option will prevent syslogd from logging the hostname with every log messages. If there are no objections I'm going to commit this in the next couple of days. Index: syslogd.c =================================================================== --- syslogd.c (revision 220452) +++ syslogd.c (working copy) _at__at_ -301,6 +301,7 _at__at_ /* 0=no, 1=numeric, 2=names */ static int KeepKernFac; /* Keep remotely logged kernel facility */ static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */ +static int LogHost = 1; static struct pidfh *pfh; volatile sig_atomic_t MarkSet, WantDie; _at__at_ -358,7 +359,7 _at__at_ dprintf("madvise() failed: %s\n", strerror(errno)); bindhostname = NULL; - while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nop:P:sS:Tuv")) + while ((ch = getopt(argc, argv, "468Aa:b:cCdf:Hkl:m:nop:P:sS:Tuv")) != -1) switch (ch) { case '4': _at__at_ -394,6 +395,9 _at__at_ case 'f': /* configuration file */ ConfFile = optarg; break; + case 'H': /* don't log the origin hostname */ + LogHost = 0; + break; case 'k': /* keep remote kern fac */ KeepKernFac = 1; break; _at__at_ -1150,12 +1154,20 _at__at_ } v++; - v->iov_base = f->f_prevhost; - v->iov_len = strlen(v->iov_base); + if (LogHost) { + v->iov_base = f->f_prevhost; + v->iov_len = strlen(v->iov_base); + v++; + v->iov_base = space; + v->iov_len = 1; + } else { + v->iov_base = nul; + v->iov_len = 0; + v++; + v->iov_base = nul; + v->iov_len = 0; + } v++; - v->iov_base = space; - v->iov_len = 1; - v++; if (msg) { wmsg = strdup(msg); /* XXX iov_base needs a `const' sibling. */Received on Fri Apr 08 2011 - 13:15:24 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:13 UTC