summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2005-07-20 15:38:38 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2005-07-20 15:38:38 +0000
commit16803e855a7234b4f27066e2dc4383edd9511c78 (patch)
tree35d0c019d0e7f69d0a30edbc67766bbfa2c70bee
parent1545ee4272a7667bb51ce58d20605f037cb751db (diff)
downloadrsyslog-16803e855a7234b4f27066e2dc4383edd9511c78.tar.gz
rsyslog-16803e855a7234b4f27066e2dc4383edd9511c78.tar.xz
rsyslog-16803e855a7234b4f27066e2dc4383edd9511c78.zip
fixed a wrong default message format
-rw-r--r--NEWS5
-rw-r--r--syslogd.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index cc721dc8..3c117a12 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,11 @@ Version 0.9.4 (RGer), around 2005-07-20
- fixed "the semiconlon" bug. rsyslogd dumped core if a write-db action
was specified but no semicolon was given after the password (an empty
template was ok, but the semicolon needed to be present).
+- changed a default for traditional output format. During testing, it
+ was seen that the timestamp written to file in default format was
+ the time of message reception, not the time specified in the TIMESTAMP
+ field of the message itself. Traditionally, the message TIMESTAMP is
+ used and this has been changed now.
---------------------------------------------------------------------------
Version 0.9.3 (RGer), 2005-07-19
- fixed a bug in the message parser. In June, the RFC 3164 timestamp
diff --git a/syslogd.c b/syslogd.c
index 0ba09577..11e59ce0 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -582,7 +582,7 @@ int Initialized = 0; /* set when we have initialized ourselves
extern int errno;
/* hardcoded standard templates (used for defaults) */
-static char template_TraditionalFormat[] = "\"%timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n\"";
+static char template_TraditionalFormat[] = "\"%TIMESTAMP% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n\"";
static char template_WallFmt[] = "\"\r\n\7Message from syslogd@%HOSTNAME% at %timegenerated% ...\r\n %syslogtag%%msg%\n\r\"";
static char template_StdFwdFmt[] = "\"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%\"";
static char template_StdUsrMsgFmt[] = "\" %syslogtag%%msg%\n\r\"";
@@ -1004,7 +1004,15 @@ dprintf("##sending '%s'\n", msg);
lenSend = send(f->f_file, msg, len, 0);
dprintf("##Sent %d bytes, requested %d\n", lenSend, len);
- if(lenSend == len) {
+ /* Some messages already contain a \n character at the end
+ * of the message. We append one only if we there is not
+ * already one. This seems the best fit, though this also
+ * means the message does not arrive unaltered at the final
+ * destination. But in the spirit of legacy syslog, this is
+ * probably the best to do...
+ * rgerhards 2005-07-20
+ */
+ if((lenSend == len) && (*(msg+len-1) != '\n')) {
/* ok, this is a quick hack... rgerhards 2005-07-06 */
if(send(f->f_file, "\n", 1, 0) == 1)
return 0; /* we are done! */