89 lines
2.9 KiB
Diff
89 lines
2.9 KiB
Diff
--- sysklogd.8
|
|
+++ sysklogd.8 Wed May 23 18:59:26 2001
|
|
@@ -29,6 +29,7 @@
|
|
.RB [ " \-s "
|
|
.I domainlist
|
|
]
|
|
+.RB [ " \-t " ]
|
|
.RB [ " \-v " ]
|
|
.LP
|
|
.SH DESCRIPTION
|
|
@@ -149,6 +150,11 @@
|
|
is specified and the host logging resolves to satu.infodrom.north.de
|
|
no domain would be cut, you will have to specify two domains like:
|
|
.BR "\-s north.de:infodrom.north.de" .
|
|
+.TP
|
|
+.B "\-t"
|
|
+Tag forwarded messages with the sending hosts name as seen by the forwarder.
|
|
+Useful for relaying syslog from DMZs through the firwall to an internal
|
|
+loghost.
|
|
.TP
|
|
.B "\-v"
|
|
Print version and exit.
|
|
--- syslogd.c
|
|
+++ syslogd.c Wed May 23 19:01:21 2001
|
|
@@ -417,6 +417,13 @@
|
|
* file is defined in the used libc and should not be hardcoded
|
|
* into the syslogd binary referring the system it was compiled on.
|
|
*
|
|
+ * Mon Oct 18 19:23:00 CEST 1999: Andreas Siegert <afx@suse.de>
|
|
+ * Added -t flag that triggers tagging of forwarded messages with
|
|
+ * the sending hosts name as seen by the forwarder.
|
|
+ * Useful for relaying syslog from DMZs through the firwall to an
|
|
+ * internal loghost.
|
|
+ * Format is "<""hostname"
|
|
+ *
|
|
* Sun Sep 17 20:45:33 CEST 2000: Martin Schulze <joey@infodrom.ffis.de>
|
|
* Fixed some bugs in printline() code that did not escape
|
|
* control characters '\177' through '\237' and contained a
|
|
@@ -731,6 +738,7 @@
|
|
int MarkSeq = 0; /* mark sequence number */
|
|
int NoFork = 0; /* don't fork - don't run in daemon mode */
|
|
int AcceptRemote = 0; /* receive messages that come via UDP */
|
|
+int TagForward = 0; /* afx: tag remote messages with the hostname they came from */
|
|
char **StripDomains = NULL; /* these domains may be stripped before writing logs */
|
|
char **LocalHosts = NULL; /* these hosts are logged with their hostname */
|
|
int NoHops = 1; /* Can we bounce syslog messages through an
|
|
@@ -829,7 +837,7 @@
|
|
funix[i] = -1;
|
|
}
|
|
|
|
- while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF)
|
|
+ while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:tv")) != EOF)
|
|
switch((char)ch) {
|
|
case 'a':
|
|
if (nfunix < MAXFUNIX)
|
|
@@ -874,6 +882,10 @@
|
|
}
|
|
StripDomains = crunch_list(optarg);
|
|
break;
|
|
+/* afx add -t for hostname tagging */
|
|
+ case 't':
|
|
+ TagForward = 1;
|
|
+ break;
|
|
case 'v':
|
|
printf("syslogd %s.%s\n", VERSION, PATCHLEVEL);
|
|
exit (0);
|
|
@@ -1771,8 +1783,19 @@
|
|
dprintf("Not sending message to remote.\n");
|
|
else {
|
|
f->f_time = now;
|
|
- (void) snprintf(line, sizeof(line), "<%d>%s\n", f->f_prevpri, \
|
|
- (char *) iov[4].iov_base);
|
|
+/* afx: add <sourcehost
|
|
+ */
|
|
+ if ((TagForward == 1) &&
|
|
+ strncmp(f->f_prevhost,LocalHostName,MAXHOSTNAMELEN+1)) {
|
|
+ (void) snprintf(line, sizeof(line), "<%d><%s: %s\n",
|
|
+ f->f_prevpri, f->f_prevhost,
|
|
+ (char *) iov[4].iov_base);
|
|
+ } else {
|
|
+ (void) snprintf(line, sizeof(line), "<%d>%s\n",
|
|
+ f->f_prevpri,
|
|
+ (char *) iov[4].iov_base);
|
|
+ }
|
|
+/* end afx */
|
|
l = strlen(line);
|
|
if (l > MAXLINE)
|
|
l = MAXLINE;
|