diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-07-20 23:41:24 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-07-20 23:41:24 +0000 |
commit | ced2cefcca08eea3e9a293af6db9637769231e05 (patch) | |
tree | 240c6ade1f934a9a93134a0f2fd5e21df0e5d769 | |
parent | 1f45b268cb5b0b11557f562ee5a5f54d60ac72aa (diff) | |
download | busybox-w32-ced2cefcca08eea3e9a293af6db9637769231e05.tar.gz busybox-w32-ced2cefcca08eea3e9a293af6db9637769231e05.tar.bz2 busybox-w32-ced2cefcca08eea3e9a293af6db9637769231e05.zip |
* syslogd can now log messages to a remote host -- patch thanks
to Gyepi Sam <gyepi@praxis-sw.com>
-Erik
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | Changelog | 11 | ||||
-rw-r--r-- | applets/usage.c | 3 | ||||
-rw-r--r-- | busybox.def.h | 3 | ||||
-rw-r--r-- | docs/busybox.pod | 8 | ||||
-rw-r--r-- | docs/busybox.sgml | 3 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 104 | ||||
-rw-r--r-- | syslogd.c | 104 | ||||
-rw-r--r-- | usage.c | 3 |
9 files changed, 239 insertions, 3 deletions
@@ -46,6 +46,9 @@ Bruce Perens <bruce@pixar.com> | |||
46 | Pavel Roskin <proski@gnu.org> | 46 | Pavel Roskin <proski@gnu.org> |
47 | Lots of bugs fixes and patches. | 47 | Lots of bugs fixes and patches. |
48 | 48 | ||
49 | Gyepi Sam <gyepi@praxis-sw.com> | ||
50 | Remote logging feature for syslogd | ||
51 | |||
49 | Linus Torvalds <torvalds@transmeta.com> | 52 | Linus Torvalds <torvalds@transmeta.com> |
50 | mkswap, fsck.minix, mkfs.minix | 53 | mkswap, fsck.minix, mkfs.minix |
51 | 54 | ||
@@ -1,3 +1,14 @@ | |||
1 | 0.47 | ||
2 | |||
3 | * 'make install' now creates relative symlinks, and added a new | ||
4 | 'make install-hardlinks' target to (tada) install hardlinks. | ||
5 | * syslogd can now log messages to a remote host -- patch thanks | ||
6 | to Gyepi Sam <gyepi@praxis-sw.com> | ||
7 | |||
8 | |||
9 | -Erik Andersen | ||
10 | |||
11 | |||
1 | 0.46 | 12 | 0.46 |
2 | 13 | ||
3 | * Better portability. Now should compile cleanly with libc5, | 14 | * Better portability. Now should compile cleanly with libc5, |
diff --git a/applets/usage.c b/applets/usage.c index 58f9820ba..b86df330c 100644 --- a/applets/usage.c +++ b/applets/usage.c | |||
@@ -998,6 +998,9 @@ const char syslogd_usage[] = | |||
998 | "\t-K\t\tDo not start up the klogd process\n" | 998 | "\t-K\t\tDo not start up the klogd process\n" |
999 | #endif | 999 | #endif |
1000 | "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n" | 1000 | "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n" |
1001 | #ifdef BB_FEATURE_REMOTE_LOG | ||
1002 | "\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" | ||
1003 | #endif | ||
1001 | #endif | 1004 | #endif |
1002 | ; | 1005 | ; |
1003 | #endif | 1006 | #endif |
diff --git a/busybox.def.h b/busybox.def.h index 7acfb2822..2c98af40d 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
@@ -186,6 +186,9 @@ | |||
186 | //Should syslogd also provide klogd support? | 186 | //Should syslogd also provide klogd support? |
187 | #define BB_FEATURE_KLOGD | 187 | #define BB_FEATURE_KLOGD |
188 | // | 188 | // |
189 | // enable syslogd -R remotehost | ||
190 | #define BB_FEATURE_REMOTE_LOG | ||
191 | // | ||
189 | //Simple tail implementation (2k vs 6k for the full one). Still | 192 | //Simple tail implementation (2k vs 6k for the full one). Still |
190 | //provides 'tail -f' support -- but for only one file at a time. | 193 | //provides 'tail -f' support -- but for only one file at a time. |
191 | #define BB_FEATURE_SIMPLE_TAIL | 194 | #define BB_FEATURE_SIMPLE_TAIL |
diff --git a/docs/busybox.pod b/docs/busybox.pod index 0e611deef..ca241433f 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod | |||
@@ -1577,6 +1577,12 @@ Options: | |||
1577 | -n Run as a foreground process | 1577 | -n Run as a foreground process |
1578 | -K Do not start up the klogd process | 1578 | -K Do not start up the klogd process |
1579 | -O FILE Use an alternate log file (default=/var/log/messages) | 1579 | -O FILE Use an alternate log file (default=/var/log/messages) |
1580 | -R HOST[:PORT] Log messages to HOST on PORT (default=514) over UDP. | ||
1581 | |||
1582 | Example: | ||
1583 | |||
1584 | $ syslogd -R masterlog:514 | ||
1585 | $ syslogd -R 192.168.1.1:601 | ||
1580 | 1586 | ||
1581 | ------------------------------- | 1587 | ------------------------------- |
1582 | 1588 | ||
@@ -2028,4 +2034,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
2028 | 2034 | ||
2029 | =cut | 2035 | =cut |
2030 | 2036 | ||
2031 | # $Id: busybox.pod,v 1.56 2000/07/11 17:29:36 andersen Exp $ | 2037 | # $Id: busybox.pod,v 1.57 2000/07/20 23:41:24 andersen Exp $ |
diff --git a/docs/busybox.sgml b/docs/busybox.sgml index 92b02c9ee..f0dd3bf62 100644 --- a/docs/busybox.sgml +++ b/docs/busybox.sgml | |||
@@ -2804,6 +2804,7 @@ | |||
2804 | -n Run as a foreground process | 2804 | -n Run as a foreground process |
2805 | -K Do not start up the klogd process | 2805 | -K Do not start up the klogd process |
2806 | -O FILE Use an alternate log file (default=/var/log/messages) | 2806 | -O FILE Use an alternate log file (default=/var/log/messages) |
2807 | -R HOST[:PORT] Log messages to HOST on PORT (default=514) over UDP. | ||
2807 | </screen> | 2808 | </screen> |
2808 | </para> | 2809 | </para> |
2809 | 2810 | ||
@@ -2813,6 +2814,8 @@ | |||
2813 | 2814 | ||
2814 | <para> | 2815 | <para> |
2815 | <screen> | 2816 | <screen> |
2817 | $ syslogd -R masterlog:514 | ||
2818 | $ syslogd -R 192.168.1.1:601 | ||
2816 | </screen> | 2819 | </screen> |
2817 | </para> | 2820 | </para> |
2818 | </sect1> | 2821 | </sect1> |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 264d899f3..508a6572b 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -61,6 +61,7 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len); | |||
61 | /* SYSLOG_NAMES defined to pull some extra junk from syslog.h */ | 61 | /* SYSLOG_NAMES defined to pull some extra junk from syslog.h */ |
62 | #define SYSLOG_NAMES | 62 | #define SYSLOG_NAMES |
63 | #include <sys/syslog.h> | 63 | #include <sys/syslog.h> |
64 | #include <sys/uio.h> | ||
64 | 65 | ||
65 | /* Path for the file where all log messages are written */ | 66 | /* Path for the file where all log messages are written */ |
66 | #define __LOG_FILE "/var/log/messages" | 67 | #define __LOG_FILE "/var/log/messages" |
@@ -76,6 +77,18 @@ static int MarkInterval = 20 * 60; | |||
76 | /* localhost's name */ | 77 | /* localhost's name */ |
77 | static char LocalHostName[32]; | 78 | static char LocalHostName[32]; |
78 | 79 | ||
80 | #ifdef BB_FEATURE_REMOTE_LOG | ||
81 | #include <netinet/in.h> | ||
82 | /* udp socket for logging to remote host */ | ||
83 | static int remotefd = -1; | ||
84 | /* where do we log? */ | ||
85 | static char *RemoteHost; | ||
86 | /* what port to log to? */ | ||
87 | static int RemotePort = 514; | ||
88 | /* To remote log or not to remote log, that is the question. */ | ||
89 | static int doRemoteLog = FALSE; | ||
90 | #endif | ||
91 | |||
79 | /* Note: There is also a function called "message()" in init.c */ | 92 | /* Note: There is also a function called "message()" in init.c */ |
80 | /* Print a message to the log file. */ | 93 | /* Print a message to the log file. */ |
81 | static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | 94 | static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2))); |
@@ -151,6 +164,30 @@ static void logMessage (int pri, char *msg) | |||
151 | 164 | ||
152 | /* now spew out the message to wherever it is supposed to go */ | 165 | /* now spew out the message to wherever it is supposed to go */ |
153 | message("%s %s %s %s\n", timestamp, LocalHostName, res, msg); | 166 | message("%s %s %s %s\n", timestamp, LocalHostName, res, msg); |
167 | |||
168 | #ifdef BB_FEATURE_REMOTE_LOG | ||
169 | /* send message to remote logger */ | ||
170 | if ( -1 != remotefd){ | ||
171 | #define IOV_COUNT 2 | ||
172 | struct iovec iov[IOV_COUNT]; | ||
173 | struct iovec *v = iov; | ||
174 | |||
175 | bzero(&res, sizeof(res)); | ||
176 | snprintf(res, sizeof(res), "<%d>", pri); | ||
177 | v->iov_base = res ; | ||
178 | v->iov_len = strlen(res); | ||
179 | v++; | ||
180 | |||
181 | v->iov_base = msg; | ||
182 | v->iov_len = strlen(msg); | ||
183 | |||
184 | if ( -1 == writev(remotefd,iov, IOV_COUNT)){ | ||
185 | fatalError("syslogd: cannot write to remote file handle on" | ||
186 | "%s:%d\n",RemoteHost,RemotePort); | ||
187 | } | ||
188 | } | ||
189 | #endif | ||
190 | |||
154 | } | 191 | } |
155 | 192 | ||
156 | static void quit_signal(int sig) | 193 | static void quit_signal(int sig) |
@@ -191,8 +228,9 @@ static int serveConnection (int conn) | |||
191 | while (isdigit (*(++p))) { | 228 | while (isdigit (*(++p))) { |
192 | pri = 10 * pri + (*p - '0'); | 229 | pri = 10 * pri + (*p - '0'); |
193 | } | 230 | } |
194 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) | 231 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){ |
195 | pri = (LOG_USER | LOG_NOTICE); | 232 | pri = (LOG_USER | LOG_NOTICE); |
233 | } | ||
196 | } else if (c == '\n') { | 234 | } else if (c == '\n') { |
197 | *q++ = ' '; | 235 | *q++ = ' '; |
198 | } else if (iscntrl (c) && (c < 0177)) { | 236 | } else if (iscntrl (c) && (c < 0177)) { |
@@ -210,6 +248,43 @@ static int serveConnection (int conn) | |||
210 | return (0); | 248 | return (0); |
211 | } | 249 | } |
212 | 250 | ||
251 | |||
252 | #ifdef BB_FEATURE_REMOTE_LOG | ||
253 | static void init_RemoteLog (void){ | ||
254 | |||
255 | struct sockaddr_in remoteaddr; | ||
256 | struct hostent *hostinfo; | ||
257 | int len = sizeof(remoteaddr); | ||
258 | |||
259 | bzero(&remoteaddr, len); | ||
260 | |||
261 | remotefd = socket(AF_INET, SOCK_DGRAM, 0); | ||
262 | |||
263 | if (remotefd < 0) { | ||
264 | fatalError("syslogd: cannot create socket\n"); | ||
265 | } | ||
266 | |||
267 | hostinfo = (struct hostent *) gethostbyname(RemoteHost); | ||
268 | |||
269 | if (!hostinfo) { | ||
270 | fatalError("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); | ||
271 | } | ||
272 | |||
273 | remoteaddr.sin_family = AF_INET; | ||
274 | remoteaddr.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; | ||
275 | remoteaddr.sin_port = htons(RemotePort); | ||
276 | |||
277 | /* | ||
278 | Since we are using UDP sockets, connect just sets the default host and port | ||
279 | for future operations | ||
280 | */ | ||
281 | if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ | ||
282 | fatalError("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); | ||
283 | } | ||
284 | |||
285 | } | ||
286 | #endif | ||
287 | |||
213 | static void doSyslogd (void) __attribute__ ((noreturn)); | 288 | static void doSyslogd (void) __attribute__ ((noreturn)); |
214 | static void doSyslogd (void) | 289 | static void doSyslogd (void) |
215 | { | 290 | { |
@@ -254,6 +329,12 @@ static void doSyslogd (void) | |||
254 | FD_ZERO (&fds); | 329 | FD_ZERO (&fds); |
255 | FD_SET (sock_fd, &fds); | 330 | FD_SET (sock_fd, &fds); |
256 | 331 | ||
332 | #ifdef BB_FEATURE_REMOTE_LOG | ||
333 | if (doRemoteLog == TRUE){ | ||
334 | init_RemoteLog(); | ||
335 | } | ||
336 | #endif | ||
337 | |||
257 | logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")"); | 338 | logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")"); |
258 | 339 | ||
259 | for (;;) { | 340 | for (;;) { |
@@ -322,6 +403,13 @@ static void doKlogd (void) | |||
322 | signal(SIGKILL, klogd_signal); | 403 | signal(SIGKILL, klogd_signal); |
323 | signal(SIGTERM, klogd_signal); | 404 | signal(SIGTERM, klogd_signal); |
324 | signal(SIGHUP, SIG_IGN); | 405 | signal(SIGHUP, SIG_IGN); |
406 | |||
407 | #ifdef BB_FEATURE_REMOTE_LOG | ||
408 | if (doRemoteLog == TRUE){ | ||
409 | init_RemoteLog(); | ||
410 | } | ||
411 | #endif | ||
412 | |||
325 | logMessage(0, "klogd started: " | 413 | logMessage(0, "klogd started: " |
326 | "BusyBox v" BB_VER " (" BB_BT ")"); | 414 | "BusyBox v" BB_VER " (" BB_BT ")"); |
327 | 415 | ||
@@ -423,6 +511,20 @@ extern int syslogd_main(int argc, char **argv) | |||
423 | logFilePath = *(++argv1); | 511 | logFilePath = *(++argv1); |
424 | stopDoingThat = TRUE; | 512 | stopDoingThat = TRUE; |
425 | break; | 513 | break; |
514 | #ifdef BB_FEATURE_REMOTE_LOG | ||
515 | case 'R': | ||
516 | if (--argc == 0) { | ||
517 | usage(syslogd_usage); | ||
518 | } | ||
519 | RemoteHost = *(++argv1); | ||
520 | if ( (p = strchr(RemoteHost, ':'))){ | ||
521 | RemotePort = atoi(p+1); | ||
522 | *p = '\0'; | ||
523 | } | ||
524 | doRemoteLog = TRUE; | ||
525 | stopDoingThat = TRUE; | ||
526 | break; | ||
527 | #endif | ||
426 | default: | 528 | default: |
427 | usage(syslogd_usage); | 529 | usage(syslogd_usage); |
428 | } | 530 | } |
@@ -61,6 +61,7 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len); | |||
61 | /* SYSLOG_NAMES defined to pull some extra junk from syslog.h */ | 61 | /* SYSLOG_NAMES defined to pull some extra junk from syslog.h */ |
62 | #define SYSLOG_NAMES | 62 | #define SYSLOG_NAMES |
63 | #include <sys/syslog.h> | 63 | #include <sys/syslog.h> |
64 | #include <sys/uio.h> | ||
64 | 65 | ||
65 | /* Path for the file where all log messages are written */ | 66 | /* Path for the file where all log messages are written */ |
66 | #define __LOG_FILE "/var/log/messages" | 67 | #define __LOG_FILE "/var/log/messages" |
@@ -76,6 +77,18 @@ static int MarkInterval = 20 * 60; | |||
76 | /* localhost's name */ | 77 | /* localhost's name */ |
77 | static char LocalHostName[32]; | 78 | static char LocalHostName[32]; |
78 | 79 | ||
80 | #ifdef BB_FEATURE_REMOTE_LOG | ||
81 | #include <netinet/in.h> | ||
82 | /* udp socket for logging to remote host */ | ||
83 | static int remotefd = -1; | ||
84 | /* where do we log? */ | ||
85 | static char *RemoteHost; | ||
86 | /* what port to log to? */ | ||
87 | static int RemotePort = 514; | ||
88 | /* To remote log or not to remote log, that is the question. */ | ||
89 | static int doRemoteLog = FALSE; | ||
90 | #endif | ||
91 | |||
79 | /* Note: There is also a function called "message()" in init.c */ | 92 | /* Note: There is also a function called "message()" in init.c */ |
80 | /* Print a message to the log file. */ | 93 | /* Print a message to the log file. */ |
81 | static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | 94 | static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2))); |
@@ -151,6 +164,30 @@ static void logMessage (int pri, char *msg) | |||
151 | 164 | ||
152 | /* now spew out the message to wherever it is supposed to go */ | 165 | /* now spew out the message to wherever it is supposed to go */ |
153 | message("%s %s %s %s\n", timestamp, LocalHostName, res, msg); | 166 | message("%s %s %s %s\n", timestamp, LocalHostName, res, msg); |
167 | |||
168 | #ifdef BB_FEATURE_REMOTE_LOG | ||
169 | /* send message to remote logger */ | ||
170 | if ( -1 != remotefd){ | ||
171 | #define IOV_COUNT 2 | ||
172 | struct iovec iov[IOV_COUNT]; | ||
173 | struct iovec *v = iov; | ||
174 | |||
175 | bzero(&res, sizeof(res)); | ||
176 | snprintf(res, sizeof(res), "<%d>", pri); | ||
177 | v->iov_base = res ; | ||
178 | v->iov_len = strlen(res); | ||
179 | v++; | ||
180 | |||
181 | v->iov_base = msg; | ||
182 | v->iov_len = strlen(msg); | ||
183 | |||
184 | if ( -1 == writev(remotefd,iov, IOV_COUNT)){ | ||
185 | fatalError("syslogd: cannot write to remote file handle on" | ||
186 | "%s:%d\n",RemoteHost,RemotePort); | ||
187 | } | ||
188 | } | ||
189 | #endif | ||
190 | |||
154 | } | 191 | } |
155 | 192 | ||
156 | static void quit_signal(int sig) | 193 | static void quit_signal(int sig) |
@@ -191,8 +228,9 @@ static int serveConnection (int conn) | |||
191 | while (isdigit (*(++p))) { | 228 | while (isdigit (*(++p))) { |
192 | pri = 10 * pri + (*p - '0'); | 229 | pri = 10 * pri + (*p - '0'); |
193 | } | 230 | } |
194 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) | 231 | if (pri & ~(LOG_FACMASK | LOG_PRIMASK)){ |
195 | pri = (LOG_USER | LOG_NOTICE); | 232 | pri = (LOG_USER | LOG_NOTICE); |
233 | } | ||
196 | } else if (c == '\n') { | 234 | } else if (c == '\n') { |
197 | *q++ = ' '; | 235 | *q++ = ' '; |
198 | } else if (iscntrl (c) && (c < 0177)) { | 236 | } else if (iscntrl (c) && (c < 0177)) { |
@@ -210,6 +248,43 @@ static int serveConnection (int conn) | |||
210 | return (0); | 248 | return (0); |
211 | } | 249 | } |
212 | 250 | ||
251 | |||
252 | #ifdef BB_FEATURE_REMOTE_LOG | ||
253 | static void init_RemoteLog (void){ | ||
254 | |||
255 | struct sockaddr_in remoteaddr; | ||
256 | struct hostent *hostinfo; | ||
257 | int len = sizeof(remoteaddr); | ||
258 | |||
259 | bzero(&remoteaddr, len); | ||
260 | |||
261 | remotefd = socket(AF_INET, SOCK_DGRAM, 0); | ||
262 | |||
263 | if (remotefd < 0) { | ||
264 | fatalError("syslogd: cannot create socket\n"); | ||
265 | } | ||
266 | |||
267 | hostinfo = (struct hostent *) gethostbyname(RemoteHost); | ||
268 | |||
269 | if (!hostinfo) { | ||
270 | fatalError("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); | ||
271 | } | ||
272 | |||
273 | remoteaddr.sin_family = AF_INET; | ||
274 | remoteaddr.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; | ||
275 | remoteaddr.sin_port = htons(RemotePort); | ||
276 | |||
277 | /* | ||
278 | Since we are using UDP sockets, connect just sets the default host and port | ||
279 | for future operations | ||
280 | */ | ||
281 | if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ | ||
282 | fatalError("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); | ||
283 | } | ||
284 | |||
285 | } | ||
286 | #endif | ||
287 | |||
213 | static void doSyslogd (void) __attribute__ ((noreturn)); | 288 | static void doSyslogd (void) __attribute__ ((noreturn)); |
214 | static void doSyslogd (void) | 289 | static void doSyslogd (void) |
215 | { | 290 | { |
@@ -254,6 +329,12 @@ static void doSyslogd (void) | |||
254 | FD_ZERO (&fds); | 329 | FD_ZERO (&fds); |
255 | FD_SET (sock_fd, &fds); | 330 | FD_SET (sock_fd, &fds); |
256 | 331 | ||
332 | #ifdef BB_FEATURE_REMOTE_LOG | ||
333 | if (doRemoteLog == TRUE){ | ||
334 | init_RemoteLog(); | ||
335 | } | ||
336 | #endif | ||
337 | |||
257 | logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")"); | 338 | logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")"); |
258 | 339 | ||
259 | for (;;) { | 340 | for (;;) { |
@@ -322,6 +403,13 @@ static void doKlogd (void) | |||
322 | signal(SIGKILL, klogd_signal); | 403 | signal(SIGKILL, klogd_signal); |
323 | signal(SIGTERM, klogd_signal); | 404 | signal(SIGTERM, klogd_signal); |
324 | signal(SIGHUP, SIG_IGN); | 405 | signal(SIGHUP, SIG_IGN); |
406 | |||
407 | #ifdef BB_FEATURE_REMOTE_LOG | ||
408 | if (doRemoteLog == TRUE){ | ||
409 | init_RemoteLog(); | ||
410 | } | ||
411 | #endif | ||
412 | |||
325 | logMessage(0, "klogd started: " | 413 | logMessage(0, "klogd started: " |
326 | "BusyBox v" BB_VER " (" BB_BT ")"); | 414 | "BusyBox v" BB_VER " (" BB_BT ")"); |
327 | 415 | ||
@@ -423,6 +511,20 @@ extern int syslogd_main(int argc, char **argv) | |||
423 | logFilePath = *(++argv1); | 511 | logFilePath = *(++argv1); |
424 | stopDoingThat = TRUE; | 512 | stopDoingThat = TRUE; |
425 | break; | 513 | break; |
514 | #ifdef BB_FEATURE_REMOTE_LOG | ||
515 | case 'R': | ||
516 | if (--argc == 0) { | ||
517 | usage(syslogd_usage); | ||
518 | } | ||
519 | RemoteHost = *(++argv1); | ||
520 | if ( (p = strchr(RemoteHost, ':'))){ | ||
521 | RemotePort = atoi(p+1); | ||
522 | *p = '\0'; | ||
523 | } | ||
524 | doRemoteLog = TRUE; | ||
525 | stopDoingThat = TRUE; | ||
526 | break; | ||
527 | #endif | ||
426 | default: | 528 | default: |
427 | usage(syslogd_usage); | 529 | usage(syslogd_usage); |
428 | } | 530 | } |
@@ -998,6 +998,9 @@ const char syslogd_usage[] = | |||
998 | "\t-K\t\tDo not start up the klogd process\n" | 998 | "\t-K\t\tDo not start up the klogd process\n" |
999 | #endif | 999 | #endif |
1000 | "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n" | 1000 | "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)\n" |
1001 | #ifdef BB_FEATURE_REMOTE_LOG | ||
1002 | "\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" | ||
1003 | #endif | ||
1001 | #endif | 1004 | #endif |
1002 | ; | 1005 | ; |
1003 | #endif | 1006 | #endif |