diff options
author | Nathan Scott <nathans@aconex.com> | 2011-08-15 22:22:13 +1000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-01-17 10:31:37 +0100 |
commit | f8019d52f83884acb5e8f8755fe976d1592b4ccb (patch) | |
tree | 58f9362b2f4124489604e2a1f0d263898269b98c /tools/syslogd.c | |
parent | 052b1c75945106c6336fd0c172fbaa129248334c (diff) | |
download | rsyslog-f8019d52f83884acb5e8f8755fe976d1592b4ccb.tar.gz rsyslog-f8019d52f83884acb5e8f8755fe976d1592b4ccb.tar.bz2 rsyslog-f8019d52f83884acb5e8f8755fe976d1592b4ccb.zip |
add elasticsearch output module
Add support for sending events to elasticsearch - a distributed,
RESTful, search engine built on Lucene (www.elasticsearch.org).
The output module is enabled via a configure option, and uses
libcurl to send the messages from rsyslog to elasticsearch.
This patch makes use of the earlier JSON quoting patch to ensure
valid JSON strings are sent to the server.
Signed-off-by: Nathan Scott <nathans@aconex.com>
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r-- | tools/syslogd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index 0b7bbc96..bec2f9a7 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -334,6 +334,7 @@ static uchar template_WallFmt[] = "\"\r\n\7Message from syslogd@%HOSTNAME% at %t 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_StdJSONFmt[] = "\"{\\\"message\\\":\\\"%msg%\\\",\\\"fromhost\\\":\\\"%HOSTNAME%\\\",\\\"facility\\\":\\\"%syslogfacility-text%\\\",\\\"priority\\\":\\\"%syslogpriority-text%\\\",\\\"timereported\\\":\\\"%timereported:::date-rfc3339%\\\",\\\"timegenerated\\\":\\\"%timegenerated:::date-rfc3339%\\\"}\",JSON"; static uchar template_spoofadr[] = "\"%fromhost-ip%\""; /* end templates */ @@ -2173,6 +2174,8 @@ static rsRetVal mainThread() tplAddLine(" StdDBFmt", &pTmp); pTmp = template_StdPgSQLFmt; tplAddLine(" StdPgSQLFmt", &pTmp); + pTmp = template_StdJSONFmt; + tplAddLine(" StdJSONFmt", &pTmp); pTmp = template_spoofadr; tplLastStaticInit(tplAddLine("RSYSLOG_omudpspoofDfltSourceTpl", &pTmp)); |