OPT_RFC3164,
OPT_RFC5424,
OPT_SOCKET_ERRORS,
+ OPT_MSGID,
OPT_ID
};
pid_t pid; /* zero when unwanted */
char *hdr; /* the syslog header (based on protocol) */
char *tag;
+ char *msgid;
char *unix_socket; /* -u <path> or default to _PATH_DEVLOG */
char *server;
char *port;
* PROCID <-- pid
* This is a relatively straightforward interpretation from
* RFC5424, sect. 6.2.6.
- * MSGID <-- '-' (NILVALUE)
+ * MSGID <-- msgid (from --msgid)
* One may argue that the string "logger" would be better suited
* here so that a receiver can identify the sender process.
* However, this does not sound like a good match to RFC5424,
- * sect. 6.2.7. It may be useful to add an option to logger to
- * specify a message ID.
+ * sect. 6.2.7.
* Note that appendix A.1 of RFC5424 does not provide clear guidance
* of how these fields should be used. This is the case because the
* IETF working group couldn't arrive at a clear agreement when we
else
procid = strdup(NILVALUE);
- char *const msgid = strdup(NILVALUE);
+ char *const msgid = strdup((ctl->msgid) ? ctl->msgid : NILVALUE);
char *structured_data;
if (ctl->rfc5424_tq) {
fputs(_(" --rfc3164 use the obsolete BSD syslog protocol\n"), out);
fputs(_(" --rfc5424[=<snip>] use the syslog protocol (the default);\n"
" <snip> can be notime, or notq, and/or nohost\n"), out);
+ fputs(_(" --msgid set rfc5424 MSGID field, ignored for non-rfc5424 format\n"), out);
fputs(_(" -u, --socket <socket> write to this Unix socket\n"), out);
fputs(_(" --socket-errors[=<on|off|auto>]\n"
" print connection errors when using Unix sockets\n"), out);
.server = NULL,
.port = NULL,
.hdr = NULL,
+ .msgid = NULL,
.socket_type = ALL_TYPES,
.max_message_size = 1024,
.rfc5424_time = 1,
{ "rfc3164", no_argument, 0, OPT_RFC3164 },
{ "rfc5424", optional_argument, 0, OPT_RFC5424 },
{ "size", required_argument, 0, 'S' },
+ { "msgid", required_argument, 0, OPT_MSGID },
{ "skip-empty", no_argument, 0, 'e' },
#ifdef HAVE_LIBSYSTEMD
{ "journald", optional_argument, 0, OPT_JOURNALD },
if (optarg)
parse_rfc5424_flags(&ctl, optarg);
break;
+ case OPT_MSGID:
+ if(strchr(optarg, ' '))
+ err(EXIT_FAILURE, _("--msgid cannot contain space"));
+ ctl.msgid = optarg;
+ break;
#ifdef HAVE_LIBSYSTEMD
case OPT_JOURNALD:
if (optarg) {