summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Heinrich <theinric@redhat.com>2012-01-10 17:07:55 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2012-01-10 17:07:55 +0100
commite25dc05e9127537cf2ddbae30b15300f601fbff0 (patch)
treee6593d21839e95d7b10310a530cca0ec9573434d
parentb6ce75cb6ce65a468f9551d98a641b407a4f2630 (diff)
downloadrsyslog-e25dc05e9127537cf2ddbae30b15300f601fbff0.tar.gz
rsyslog-e25dc05e9127537cf2ddbae30b15300f601fbff0.tar.xz
rsyslog-e25dc05e9127537cf2ddbae30b15300f601fbff0.zip
added canned template for ultra-exact sysklogd file format
the point is that LF will be translated to SP Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
-rw-r--r--doc/rsyslog_conf_templates.html4
-rw-r--r--tools/syslogd.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/doc/rsyslog_conf_templates.html b/doc/rsyslog_conf_templates.html
index 6c68b801..5790ba8a 100644
--- a/doc/rsyslog_conf_templates.html
+++ b/doc/rsyslog_conf_templates.html
@@ -118,6 +118,10 @@ with high-precision timestamps and timezone information</li>
useful if you send&nbsp;messages to other syslogd's or rsyslogd
below
version 3.12.5.</li>
+<li><span style="font-weight: bold;">RSYSLOG_SysklogdFileFormat</span>
+- sysklogd compatible log file format. If used with options: $SpaceLFOnReceive on;
+$EscapeControlCharactersOnReceive off; $DropTrailingLFOnReception off,
+the log format will conform to sysklogd log format.</li>
<li><span style="font-weight: bold;">RSYSLOG_ForwardFormat</span>
- a new high-precision forwarding format very similar to the
traditional one, but with high-precision timestamps and timezone
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 64b23566..4a5cbf60 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -381,6 +381,7 @@ static uchar template_TraditionalForwardFormat[] = "\"<%PRI%>%TIMESTAMP% %HOSTNA
static uchar template_StdUsrMsgFmt[] = "\" %syslogtag%%msg%\n\r\"";
static uchar template_StdDBFmt[] = "\"insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('%msg%', %syslogfacility%, '%HOSTNAME%', %syslogpriority%, '%timereported:::date-mysql%', '%timegenerated:::date-mysql%', %iut%, '%syslogtag%')\",SQL";
static uchar template_StdPgSQLFmt[] = "\"insert into SystemEvents (Message, Facility, FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('%msg%', %syslogfacility%, '%HOSTNAME%', %syslogpriority%, '%timereported:::date-pgsql%', '%timegenerated:::date-pgsql%', %iut%, '%syslogtag%')\",STDSQL";
+static uchar template_SysklogdFileFormat[] = "\"%TIMESTAMP% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%\n\"";
/* end template */
@@ -2836,6 +2837,8 @@ static rsRetVal mainThread()
tplAddLine(" StdUsrMsgFmt", &pTmp);
pTmp = template_StdDBFmt;
tplAddLine(" StdDBFmt", &pTmp);
+ pTmp = template_SysklogdFileFormat;
+ tplAddLine("RSYSLOG_SysklogdFileFormat", &pTmp);
pTmp = template_StdPgSQLFmt;
tplLastStaticInit(tplAddLine(" StdPgSQLFmt", &pTmp));