Use datagrams (UDP) only. By default the connection is tried to the
syslog port defined in /etc/services, which is often 514 .
.TP
+.BR \-e , " \-\-skip-empty"
+When processing files, empty lines will be ignored. An empty line
+is defined to be a line without any characters. Thus a line consisting
+only of whitespace is NOT considered empty.
+Note that when the \fR\-\-prio\-prefix\fR option is specified, the priority
+is not part of the line. Thus an empty line in this mode is a line that does
+not have any characters after the priority (e.g. "<13>").
+.TP
.BR \-f , " \-\-file " \fIfile
Log the contents of the specified \fIfile\fR.
This option cannot be combined with a command-line message.
stderr_printout:1, /* output message to stderr */
rfc5424_time:1, /* include time stamp */
rfc5424_tq:1, /* include time quality markup */
- rfc5424_host:1; /* include hostname */
+ rfc5424_host:1, /* include hostname */
+ skip_empty_lines:1; /* do not send empty lines when processing files */
};
static int decode(const char *name, CODE *codetab)
}
buf[i] = '\0';
- write_output(ctl, buf);
+ if(i > 0 || !ctl->skip_empty_lines)
+ write_output(ctl, buf);
if (c == '\n') /* discard line terminator */
c = getchar();
fputs(_(" -i log the logger command's PID\n"), out);
fputs(_(" --id[=<id>] log the given <id>, or otherwise the PID\n"), out);
fputs(_(" -f, --file <file> log the contents of this file\n"), out);
+ fputs(_(" -e, --skip-empty do not log empty lines when processing files\n"), out);
fputs(_(" -p, --priority <prio> mark given message with this priority\n"), out);
fputs(_(" --prio-prefix look for a prefix on every line read from stdin\n"), out);
fputs(_(" -s, --stderr output message to standard error as well\n"), out);
.rfc5424_time = 1,
.rfc5424_tq = 1,
.rfc5424_host = 1,
+ .skip_empty_lines = 0
};
int ch;
int stdout_reopened = 0;
{ "rfc3164", no_argument, 0, OPT_RFC3164 },
{ "rfc5424", optional_argument, 0, OPT_RFC5424 },
{ "size", required_argument, 0, 'S' },
+ { "skip-empty", no_argument, 0, 'e' },
#ifdef HAVE_LIBSYSTEMD
{ "journald", optional_argument, 0, OPT_JOURNALD },
#endif
textdomain(PACKAGE);
atexit(close_stdout);
- while ((ch = getopt_long(argc, argv, "f:ip:S:st:u:dTn:P:Vh",
+ while ((ch = getopt_long(argc, argv, "ef:ip:S:st:u:dTn:P:Vh",
longopts, NULL)) != -1) {
switch (ch) {
case 'f': /* file to log */
err(EXIT_FAILURE, _("file %s"), optarg);
stdout_reopened = 1;
break;
+ case 'e':
+ ctl.skip_empty_lines = 1;
+ break;
case 'i': /* log process id also */
ctl.pid = getpid();
break;