aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/usage.c1
-rw-r--r--docs/busybox.pod7
-rw-r--r--docs/busybox.sgml1
-rw-r--r--sysklogd/syslogd.c57
-rw-r--r--syslogd.c57
-rw-r--r--usage.c1
6 files changed, 69 insertions, 55 deletions
diff --git a/applets/usage.c b/applets/usage.c
index 35d69df42..75c421a09 100644
--- a/applets/usage.c
+++ b/applets/usage.c
@@ -1176,6 +1176,7 @@ const char syslogd_usage[] =
"\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n"
#ifdef BB_FEATURE_REMOTE_LOG
"\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n"
+ "\t-N\t\tDo not log anything locally -- network logging only.\n"
#endif
#endif
;
diff --git a/docs/busybox.pod b/docs/busybox.pod
index d518c550c..9b92d1981 100644
--- a/docs/busybox.pod
+++ b/docs/busybox.pod
@@ -1702,11 +1702,12 @@ Note that this version of syslogd/klogd ignores /etc/syslog.conf.
Options:
- -m NUM Interval between MARK lines (default=20min, 0=off)
+ -m NUM Interval between MARK lines (default=20min, 0=off)
-n Run as a foreground process
-K Do not start up the klogd process
- -O FILE Use an alternate log file (default=/var/log/messages)
+ -O FILE Use an alternate log file (default=/var/log/messages)
-R HOST[:PORT] Log messages to HOST on PORT (default=514) over UDP.
+ -N Do not log anything locally -- network logging only
Example:
@@ -2261,4 +2262,4 @@ Enrique Zanardi <ezanardi@ull.es>
=cut
-# $Id: busybox.pod,v 1.77 2000/11/17 17:23:16 andersen Exp $
+# $Id: busybox.pod,v 1.78 2000/12/08 19:52:01 andersen Exp $
diff --git a/docs/busybox.sgml b/docs/busybox.sgml
index 530629b4d..1542337dd 100644
--- a/docs/busybox.sgml
+++ b/docs/busybox.sgml
@@ -2991,6 +2991,7 @@
-K Do not start up the klogd process
-O FILE Use an alternate log file (default=/var/log/messages)
-R HOST[:PORT] Log messages to HOST on PORT (default=514) over UDP.
+ -N Do not log anything locally -- network logging only
</screen>
</para>
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index bb0df8c51..75d73e322 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -79,13 +79,14 @@ static char LocalHostName[32];
#ifdef BB_FEATURE_REMOTE_LOG
#include <netinet/in.h>
/* udp socket for logging to remote host */
-static int remotefd = -1;
+static int remotefd = -1;
/* where do we log? */
static char *RemoteHost;
/* what port to log to? */
-static int RemotePort = 514;
+static int RemotePort = 514;
/* To remote log or not to remote log, that is the question. */
-static int doRemoteLog = FALSE;
+static int doRemoteLog = FALSE;
+static int local_logging = TRUE;
#endif
/* Note: There is also a function called "message()" in init.c */
@@ -139,9 +140,9 @@ static void logMessage (int pri, char *msg)
if (pri != 0) {
for (c_fac = facilitynames;
- c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri) << 3); c_fac++);
+ c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri) << 3); c_fac++);
for (c_pri = prioritynames;
- c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
+ c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
if (*c_fac->c_name == '\0' || *c_pri->c_name == '\0')
snprintf(res, sizeof(res), "<%d>", pri);
else
@@ -149,7 +150,7 @@ static void logMessage (int pri, char *msg)
}
if (strlen(msg) < 16 || msg[3] != ' ' || msg[6] != ' ' ||
- msg[9] != ':' || msg[12] != ':' || msg[15] != ' ') {
+ msg[9] != ':' || msg[12] != ':' || msg[15] != ' ') {
time(&now);
timestamp = ctime(&now) + 4;
timestamp[15] = '\0';
@@ -163,28 +164,29 @@ static void logMessage (int pri, char *msg)
#ifdef BB_FEATURE_REMOTE_LOG
/* send message to remote logger */
- if ( -1 != remotefd){
+ if ( -1 != remotefd){
#define IOV_COUNT 2
- struct iovec iov[IOV_COUNT];
- struct iovec *v = iov;
-
- bzero(&res, sizeof(res));
- snprintf(res, sizeof(res), "<%d>", pri);
- v->iov_base = res ;
- v->iov_len = strlen(res);
- v++;
-
- v->iov_base = msg;
- v->iov_len = strlen(msg);
-
- if ( -1 == writev(remotefd,iov, IOV_COUNT)){
- error_msg_and_die("syslogd: cannot write to remote file handle on"
- "%s:%d\n",RemoteHost,RemotePort);
- }
- } else
+ struct iovec iov[IOV_COUNT];
+ struct iovec *v = iov;
+
+ bzero(&res, sizeof(res));
+ snprintf(res, sizeof(res), "<%d>", pri);
+ v->iov_base = res ;
+ v->iov_len = strlen(res);
+ v++;
+
+ v->iov_base = msg;
+ v->iov_len = strlen(msg);
+
+ if ( -1 == writev(remotefd,iov, IOV_COUNT)){
+ error_msg_and_die("syslogd: cannot write to remote file handle on"
+ "%s:%d\n",RemoteHost,RemotePort);
+ }
+ }
+ if (local_logging == TRUE)
#endif
- /* now spew out the message to wherever it is supposed to go */
- message("%s %s %s %s\n", timestamp, LocalHostName, res, msg);
+ /* now spew out the message to wherever it is supposed to go */
+ message("%s %s %s %s\n", timestamp, LocalHostName, res, msg);
}
@@ -529,6 +531,9 @@ extern int syslogd_main(int argc, char **argv)
doRemoteLog = TRUE;
stopDoingThat = TRUE;
break;
+ case 'N':
+ local_logging = FALSE;
+ break;
#endif
default:
usage(syslogd_usage);
diff --git a/syslogd.c b/syslogd.c
index bb0df8c51..75d73e322 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -79,13 +79,14 @@ static char LocalHostName[32];
#ifdef BB_FEATURE_REMOTE_LOG
#include <netinet/in.h>
/* udp socket for logging to remote host */
-static int remotefd = -1;
+static int remotefd = -1;
/* where do we log? */
static char *RemoteHost;
/* what port to log to? */
-static int RemotePort = 514;
+static int RemotePort = 514;
/* To remote log or not to remote log, that is the question. */
-static int doRemoteLog = FALSE;
+static int doRemoteLog = FALSE;
+static int local_logging = TRUE;
#endif
/* Note: There is also a function called "message()" in init.c */
@@ -139,9 +140,9 @@ static void logMessage (int pri, char *msg)
if (pri != 0) {
for (c_fac = facilitynames;
- c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri) << 3); c_fac++);
+ c_fac->c_name && !(c_fac->c_val == LOG_FAC(pri) << 3); c_fac++);
for (c_pri = prioritynames;
- c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
+ c_pri->c_name && !(c_pri->c_val == LOG_PRI(pri)); c_pri++);
if (*c_fac->c_name == '\0' || *c_pri->c_name == '\0')
snprintf(res, sizeof(res), "<%d>", pri);
else
@@ -149,7 +150,7 @@ static void logMessage (int pri, char *msg)
}
if (strlen(msg) < 16 || msg[3] != ' ' || msg[6] != ' ' ||
- msg[9] != ':' || msg[12] != ':' || msg[15] != ' ') {
+ msg[9] != ':' || msg[12] != ':' || msg[15] != ' ') {
time(&now);
timestamp = ctime(&now) + 4;
timestamp[15] = '\0';
@@ -163,28 +164,29 @@ static void logMessage (int pri, char *msg)
#ifdef BB_FEATURE_REMOTE_LOG
/* send message to remote logger */
- if ( -1 != remotefd){
+ if ( -1 != remotefd){
#define IOV_COUNT 2
- struct iovec iov[IOV_COUNT];
- struct iovec *v = iov;
-
- bzero(&res, sizeof(res));
- snprintf(res, sizeof(res), "<%d>", pri);
- v->iov_base = res ;
- v->iov_len = strlen(res);
- v++;
-
- v->iov_base = msg;
- v->iov_len = strlen(msg);
-
- if ( -1 == writev(remotefd,iov, IOV_COUNT)){
- error_msg_and_die("syslogd: cannot write to remote file handle on"
- "%s:%d\n",RemoteHost,RemotePort);
- }
- } else
+ struct iovec iov[IOV_COUNT];
+ struct iovec *v = iov;
+
+ bzero(&res, sizeof(res));
+ snprintf(res, sizeof(res), "<%d>", pri);
+ v->iov_base = res ;
+ v->iov_len = strlen(res);
+ v++;
+
+ v->iov_base = msg;
+ v->iov_len = strlen(msg);
+
+ if ( -1 == writev(remotefd,iov, IOV_COUNT)){
+ error_msg_and_die("syslogd: cannot write to remote file handle on"
+ "%s:%d\n",RemoteHost,RemotePort);
+ }
+ }
+ if (local_logging == TRUE)
#endif
- /* now spew out the message to wherever it is supposed to go */
- message("%s %s %s %s\n", timestamp, LocalHostName, res, msg);
+ /* now spew out the message to wherever it is supposed to go */
+ message("%s %s %s %s\n", timestamp, LocalHostName, res, msg);
}
@@ -529,6 +531,9 @@ extern int syslogd_main(int argc, char **argv)
doRemoteLog = TRUE;
stopDoingThat = TRUE;
break;
+ case 'N':
+ local_logging = FALSE;
+ break;
#endif
default:
usage(syslogd_usage);
diff --git a/usage.c b/usage.c
index 35d69df42..75c421a09 100644
--- a/usage.c
+++ b/usage.c
@@ -1176,6 +1176,7 @@ const char syslogd_usage[] =
"\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n"
#ifdef BB_FEATURE_REMOTE_LOG
"\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n"
+ "\t-N\t\tDo not log anything locally -- network logging only.\n"
#endif
#endif
;