Browse Source

Imported Upstream version 8.4.1

upstream upstream/8.4.1
Michael Biebl 8 years ago
parent
commit
7bfd178d59
  1. 66
      ChangeLog
  2. 5
      config.h.in
  3. 39
      configure
  4. 10
      configure.ac
  5. 1332
      grammar/lexer.c
  6. 2
      grammar/lexer.l
  7. 2
      grammar/rainerscript.h
  8. 16
      plugins/imfile/imfile.c
  9. 6
      plugins/imjournal/imjournal.c
  10. 6
      plugins/imklog/imklog.c
  11. 2
      plugins/imkmsg/imkmsg.c
  12. 1
      plugins/imkmsg/kmsg.c
  13. 38
      plugins/impstats/impstats.c
  14. 4
      plugins/imsolaris/imsolaris.c
  15. 6
      plugins/imuxsock/imuxsock.c
  16. 2
      plugins/mmanon/mmanon.c
  17. 2
      plugins/mmfields/mmfields.c
  18. 14
      plugins/omelasticsearch/omelasticsearch.c
  19. 15
      plugins/ompgsql/ompgsql.c
  20. 1
      plugins/omprog/omprog.c
  21. 8
      plugins/omudpspoof/omudpspoof.c
  22. 2
      plugins/sm_cust_bindcdr/Makefile.in
  23. 10
      plugins/sm_cust_bindcdr/README
  24. 3
      rsyslog.service.in
  25. 2
      runtime/Makefile.am
  26. 8
      runtime/Makefile.in
  27. 2
      runtime/atomic.h
  28. 49
      runtime/msg.c
  29. 4
      runtime/nsd_gtls.c
  30. 8
      runtime/parser.c
  31. 2
      runtime/prop.h
  32. 66
      runtime/rsyslog.h
  33. 1
      runtime/srutils.c
  34. 5
      runtime/syslogd-types.h
  35. 4
      runtime/typedefs.h
  36. 2
      runtime/wti.h
  37. 4
      runtime/wtp.h
  38. 37
      tests/Makefile.am
  39. 62
      tests/Makefile.in
  40. 13
      tests/diag.sh
  41. 12
      tests/elasticsearch-basic-bulk.sh
  42. 17
      tests/elasticsearch-basic-errorfile-empty.sh
  43. 26
      tests/elasticsearch-basic-errorfile-populated.sh
  44. 12
      tests/elasticsearch-basic.sh
  45. 17
      tests/elasticsearch-bulk-errorfile-empty.sh
  46. 26
      tests/elasticsearch-bulk-errorfile-populated.sh
  47. 11
      tests/fac_authpriv.sh
  48. 10
      tests/fac_local0.sh
  49. 10
      tests/fac_mail.sh
  50. 10
      tests/fac_news.sh
  51. 10
      tests/fac_uucp.sh
  52. 10
      tests/testsuites/elasticsearch-basic-bulk.conf
  53. 10
      tests/testsuites/elasticsearch-basic-errorfile-empty.conf
  54. 15
      tests/testsuites/elasticsearch-basic-errorfile-populated.conf
  55. 9
      tests/testsuites/elasticsearch-basic.conf
  56. 11
      tests/testsuites/elasticsearch-bulk-errorfile-empty.conf
  57. 15
      tests/testsuites/elasticsearch-bulk-errorfile-populated.conf
  58. 7
      tests/testsuites/fac_authpriv.conf
  59. 8
      tests/testsuites/fac_local0.conf
  60. 7
      tests/testsuites/fac_mail.conf
  61. 8
      tests/testsuites/fac_news.conf
  62. 7
      tests/testsuites/fac_uucp.conf
  63. 8
      tools/rsyslogd.c

66
ChangeLog

@ -1,4 +1,38 @@
---------------------------------------------------------------------------
Version 8.4.1 [v8-stable] 2014-09-30
- imudp: add for bracketing mode, which makes parsing stats easier
- permit at-sign in variable names
closes: https://github.com/rsyslog/rsyslog/issues/110
- bugfix: fix syntax error in anon_cc_numbers.py script
Thanks to github user anthcourtney for the patch.
closes: https://github.com/rsyslog/rsyslog/issues/109
- bugfix: ompgsql: don't loose uncomitted data on retry
Thanks to Jared Johnson and Axel Rau for the patch.
- bugfix: imfile: if a state file for a different file name was set,
that different file (name) was monitored instead of the configured
one. Now, the state file is deleted and the correct file monitored.
closes: https://github.com/rsyslog/rsyslog/issues/103
- bugfix: omudpspoof: source port was invalid
Thanks to Pavel Levshin for the patch
- bugfix: build failure on systems which don't have json_tokener_errors
Older versions of json-c need to use a different API (which don't exists
on newer versions, unfortunately...)
Thanks to Thomas D. for reporting this problem.
- bugfix: omelasticsearch does not work with broken/changed ES 1.0+ API
closes: https://github.com/rsyslog/rsyslog/issues/104
- bugfix: mmanon did not properly anonymize IP addresses starting with '9'
Thanks to defa-at-so36.net for reporting this problem.
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=529
- bugfix: build problems on SuSe Linux
Thanks Andreas Stieger for the patch
- bugfix: omelasticsearch error file did not work correctly on ES 1.0+
due to a breaking change in the ElasticSearch API.
see also: https://github.com/rsyslog/rsyslog/issues/104
- bugfix: potential abort when a message with PRI > 191 was processed
if the "pri-text" property was used in active templates, this could
be abused to a remote denial of service from permitted senders
see also: CVE-2014-3634
---------------------------------------------------------------------------
Version 8.4.0 [v8-stable] 2014-08-18
- this is the new stable branch, which incorporates all enhancements of
rsyslog 8.3.
@ -388,7 +422,24 @@ Version 8.1.0 [experimental] 2013-11-15
statement. Also, it can still be build without problems, the option must
just explicitely be given.
---------------------------------------------------------------------------
Version 7.6.4 [v7.6-stable] 2014-03-??
Version 7.6.6 [v7.6-stable] 2014-09-30
- bugfix: potential abort when a message with PRI > 191 was processed
if the "pri-text" property was used in active templates, this could
be abused to a remote denial of service from permitted senders
see also: CVE-2014-3634
- bugfix: potential segfault on startup on 64 bit systems
This happened immediately on startup during config processing. Once
rsyslog got past this stage, it could not happen.
- bugfix: build problems on SuSe Linux
Thanks Andreas Stieger for the patch
---------------------------------------------------------------------------
Version 7.6.5 [v7.6-stable] 2014-09-17
- bugfix: in 7.6.4, pri-based filters did not work correctly
messages were distributed to the wrong bins.
- bugfix: build problems on systems without atomic instructons
e.g. RHEL 5; backport from v8
---------------------------------------------------------------------------
Version 7.6.4 [v7.6-stable] 2014-09-12
- add --enable-generate-man-pages configure switch (default: enabled)
This forces generation of man pages, even if cached ones exists. This
"fixes" a typical release tarball nit. While it is hackish, the
@ -417,6 +468,10 @@ Version 7.6.4 [v7.6-stable] 2014-03-??
* dirgroupnum
Thanks to Karol Jurak for the patch.
- bugfix: memory leak in TCP TLS mode
- bugfix: imfile: if a state file for a different file name was set,
that different file (name) was monitored instead of the configured
one. Now, the state file is deleted and the correct file monitored.
closes: https://github.com/rsyslog/rsyslog/issues/103
- bugfix: using UUID property could cause segfault
- bugfix: mmutf8fix did not detect two invalid sequences
Thanks to Axel Rau for the patch.
@ -450,6 +505,13 @@ Version 7.6.4 [v7.6-stable] 2014-03-??
shut down before the repetition was broken.
Thanks to Tomas Heinrich for the patch.
- bugfix: make dist failed when GUARDTIME or LIBGCRYPT feature was disabled
- bugfix: mmjsonparse did not build with json-c < 0.10
This was a regression introduced some time in the past in order to
support API changes in json-c. Now we check for the version and use
proper code.
- bugfix: mmanon did not properly anonymize IP addresses starting with '9'
Thanks to defa-at-so36.net for reporting this problem.
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=529
---------------------------------------------------------------------------
Version 7.6.3 [v7.6-stable] 2014-03-27
- add capability to override GnuTLS path in build process
@ -4513,6 +4575,8 @@ Version 3.22.4 [v3-stable] (rgerhards), 2010-??-??
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=271
- improved some code based on clang static analyzer results
- bugfix: potential misadressing in property replacer
- bugfix: improper handling of invalid PRI values
references: CVE-2014-3634
---------------------------------------------------------------------------
Version 3.22.3 [v3-stable] (rgerhards), 2010-11-24
- bugfix(important): problem in TLS handling could cause rsyslog to loop

5
config.h.in

@ -118,7 +118,7 @@
/* Define to 1 if you have the `json_object_new_int64' function. */
#undef HAVE_JSON_OBJECT_NEW_INT64
/* we have the newer JSON-C API */
/* Define to 1 if you have the `json_tokener_error_desc' function. */
#undef HAVE_JSON_TOKENER_ERROR_DESC
/* Define to 1 if you have the <libgen.h> header file. */
@ -283,9 +283,6 @@
/* set define */
#undef HAVE_SYSINFO_UPTIME
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H

39
configure

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for rsyslog 8.4.0.
# Generated by GNU Autoconf 2.68 for rsyslog 8.4.1.
#
# Report bugs to <rsyslog@lists.adiscon.com>.
#
@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rsyslog'
PACKAGE_TARNAME='rsyslog'
PACKAGE_VERSION='8.4.0'
PACKAGE_STRING='rsyslog 8.4.0'
PACKAGE_VERSION='8.4.1'
PACKAGE_STRING='rsyslog 8.4.1'
PACKAGE_BUGREPORT='rsyslog@lists.adiscon.com'
PACKAGE_URL=''
@ -1621,7 +1621,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures rsyslog 8.4.0 to adapt to many kinds of systems.
\`configure' configures rsyslog 8.4.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1691,7 +1691,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rsyslog 8.4.0:";;
short | recursive ) echo "Configuration of rsyslog 8.4.1:";;
esac
cat <<\_ACEOF
@ -1949,7 +1949,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rsyslog configure 8.4.0
rsyslog configure 8.4.1
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@ -2528,7 +2528,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by rsyslog $as_me 8.4.0, which was
It was created by rsyslog $as_me 8.4.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@ -3343,7 +3343,7 @@ fi
# Define the identity of the package.
PACKAGE='rsyslog'
VERSION='8.4.0'
VERSION='8.4.1'
cat >>confdefs.h <<_ACEOF
@ -13571,8 +13571,6 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_JSON_TOKENER_ERROR_DESC 1" >>confdefs.h
fi
elif test $pkg_failed = untried; then
@ -13669,8 +13667,6 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_JSON_TOKENER_ERROR_DESC 1" >>confdefs.h
fi
else
@ -13739,6 +13735,19 @@ fi
done
# look for newer API
for ac_func in json_tokener_error_desc
do :
ac_fn_c_check_func "$LINENO" "json_tokener_error_desc" "ac_cv_func_json_tokener_error_desc"
if test "x$ac_cv_func_json_tokener_error_desc" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_JSON_TOKENER_ERROR_DESC 1
_ACEOF
fi
done
case "${host}" in
*-*-linux*)
@ -14140,7 +14149,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
fi
for ac_header in arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h sys/inotify.h syslog.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h
for ac_header in arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h sys/inotify.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -21322,7 +21331,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by rsyslog $as_me 8.4.0, which was
This file was extended by rsyslog $as_me 8.4.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -21388,7 +21397,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
rsyslog config.status 8.4.0
rsyslog config.status 8.4.1
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

10
configure.ac

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([rsyslog],[8.4.0],[rsyslog@lists.adiscon.com])
AC_INIT([rsyslog],[8.4.1],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE([subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@ -32,14 +32,16 @@ PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES(LIBESTR, libestr >= 0.1.9)
PKG_CHECK_MODULES(LIBLOGGING_STDLOG, liblogging-stdlog >= 1.0.3)
PKG_CHECK_MODULES([JSON_C], [json],, [
PKG_CHECK_MODULES([JSON_C], [json-c],
[AC_DEFINE([HAVE_JSON_TOKENER_ERROR_DESC], [1], [we have the newer JSON-C API])])
PKG_CHECK_MODULES([JSON_C], [json-c],,)
])
# if int64 is supported, use it
AC_CHECK_LIB(json-c, json_object_new_object,,)
AC_CHECK_FUNCS(json_object_new_int64,,)
# look for newer API
AC_CHECK_FUNCS(json_tokener_error_desc,,)
case "${host}" in
*-*-linux*)
AC_DEFINE([OS_LINUX], [1], [Indicator for a Linux OS])
@ -88,7 +90,7 @@ AC_SUBST(DL_LIBS)
AC_HEADER_RESOLV
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h sys/inotify.h syslog.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h])
AC_CHECK_HEADERS([arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h sys/inotify.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

1332
grammar/lexer.c

File diff suppressed because it is too large

2
grammar/lexer.l

@ -133,7 +133,7 @@ int fileno(FILE *stream);
<EXPR>0[0-7]+ | /* octal number */
<EXPR>0x[0-7a-f] | /* hex number, following rule is dec; strtoll handles all! */
<EXPR>([1-9][0-9]*|0) { yylval.n = strtoll(yytext, NULL, 0); return NUMBER; }
<EXPR>\$[$!./]{0,1}[a-z][!a-z0-9\-_\.]* { yylval.s = strdup(yytext+1); return VAR; }
<EXPR>\$[$!./]{0,1}[@a-z][!@a-z0-9\-_\.]* { yylval.s = strdup(yytext+1); return VAR; }
<EXPR>\'([^'\\]|\\['"\\$bntr]|\\x[0-9a-f][0-9a-f]|\\[0-7][0-7][0-7])*\' {
yytext[yyleng-1] = '\0';
unescapeStr((uchar*)yytext+1, yyleng-2);

2
grammar/rainerscript.h

@ -25,7 +25,7 @@
#include <regex.h>
#include "typedefs.h"
#define LOG_NFACILITIES 24 /* current number of syslog facilities */
#define LOG_NFACILITIES 24+1 /* we copy&paste this as including rsyslog.h gets us in off64_t trouble... :-( */
#define CNFFUNC_MAX_ARGS 32
/**< maximum number of arguments that any function can have (among
* others, this is used to size data structures).

16
plugins/imfile/imfile.c

@ -376,8 +376,8 @@ static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
MsgSetMSGoffs(pMsg, 0); /* we do not have a header... */
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
MsgSetTAG(pMsg, pInfo->pszTag, pInfo->lenTag);
pMsg->iFacility = LOG_FAC(pInfo->iFacility);
pMsg->iSeverity = LOG_PRI(pInfo->iSeverity);
pMsg->iFacility = pri2fac(pInfo->iFacility);
pMsg->iSeverity = pri2sev(pInfo->iSeverity);
MsgSetRuleset(pMsg, pInfo->pRuleset);
ratelimitAddMsg(pInfo->ratelimiter, &pInfo->multiSub, pMsg);
finalize_it:
@ -422,6 +422,18 @@ openFile(fileInfo_t *pThis)
/* read back in the object */
CHKiRet(obj.Deserialize(&pThis->pStrm, (uchar*) "strm", psSF, NULL, pThis));
DBGPRINTF("imfile: deserialized state file, state file base name '%s', "
"configured base name '%s'\n", pThis->pStrm->pszFName,
pThis->pszFileName);
if(ustrcmp(pThis->pStrm->pszFName, pThis->pszFileName)) {
errmsg.LogError(0, RS_RET_STATEFILE_WRONG_FNAME, "imfile: state file '%s' "
"contains file name '%s', but is used for file '%s'. State "
"file deleted, starting from begin of file.",
pszSFNam, pThis->pStrm->pszFName, pThis->pszFileName);
unlink((char*)pszSFNam);
ABORT_FINALIZE(RS_RET_STATEFILE_WRONG_FNAME);
}
strm.CheckFileChange(pThis->pStrm);
CHKiRet(strm.SeekCurrOffs(pThis->pStrm));

6
plugins/imjournal/imjournal.c

@ -91,8 +91,8 @@ static struct cnfparamblk modpblk =
};
#define DFLT_persiststateinterval 10
#define DFLT_SEVERITY LOG_PRI(LOG_NOTICE)
#define DFLT_FACILITY LOG_FAC(LOG_USER)
#define DFLT_SEVERITY pr2fac(LOG_NOTICE)
#define DFLT_FACILITY pri2sev(LOG_USER)
static int bLegacyCnfModGlobalsPermitted = 1;/* are legacy module-global config parameters permitted? */
@ -125,7 +125,7 @@ static rsRetVal facilityHdlr(uchar **pp, void *pVal)
/* noop */;
for (c = syslogFacNames; c->c_name; c++) {
if (!strncasecmp(p, (char *) c->c_name, len)) {
*((int *) pVal) = LOG_FAC(c->c_val);
*((int *) pVal) = pri2fac(c->c_val);
break;
}
}

6
plugins/imklog/imklog.c

@ -21,7 +21,7 @@
* To test under Linux:
* echo test1 > /dev/kmsg
*
* Copyright (C) 2008-2012 Adiscon GmbH
* Copyright (C) 2008-2014 Adiscon GmbH
*
* This file is part of rsyslog.
*
@ -247,10 +247,10 @@ rsRetVal Syslog(int priority, uchar *pMsg, struct timeval *tp)
/* if we don't get the pri, we use whatever we were supplied */
/* ignore non-kernel messages if not permitted */
if(cs.bPermitNonKernel == 0 && LOG_FAC(priority) != LOG_KERN)
if(cs.bPermitNonKernel == 0 && pri2fac(priority) != LOG_KERN)
FINALIZE; /* silently ignore */
iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", LOG_FAC(priority), LOG_PRI(priority), tp);
iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", pri2fac(priority), pri2sev(priority), tp);
finalize_it:
RETiRet;

2
plugins/imkmsg/imkmsg.c

@ -144,7 +144,7 @@ rsRetVal imkmsgLogIntMsg(int priority, char *fmt, ...)
rsRetVal Syslog(int priority, uchar *pMsg, struct timeval *tp, struct json_object *json)
{
DEFiRet;
iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", LOG_FAC(priority), LOG_PRI(priority), tp, json);
iRet = enqMsg((uchar*)pMsg, (uchar*) "kernel:", pri2fac(priority), pri2sev(priority), tp, json);
RETiRet;
}

1
plugins/imkmsg/kmsg.c

@ -34,6 +34,7 @@
#include <ctype.h>
#include <sys/klog.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <json.h>
#include "rsyslog.h"

38
plugins/impstats/impstats.c

@ -83,6 +83,7 @@ struct modConfData_s {
statsFmtType_t statsFmt;
sbool bLogToSyslog;
sbool bResetCtrs;
sbool bBracketing;
char *logfile;
sbool configSetViaV2Method;
uchar *pszBindRuleset; /* name of ruleset to bind to */
@ -99,6 +100,7 @@ static struct cnfparamdescr modpdescr[] = {
{ "interval", eCmdHdlrInt, 0 },
{ "facility", eCmdHdlrInt, 0 },
{ "severity", eCmdHdlrInt, 0 },
{ "bracketing", eCmdHdlrBinary, 0 },
{ "log.syslog", eCmdHdlrBinary, 0 },
{ "resetcounters", eCmdHdlrBinary, 0 },
{ "log.file", eCmdHdlrGetWord, 0 },
@ -186,7 +188,7 @@ finalize_it:
/* log stats message to file; limited error handling done */
static inline void
doLogToFile(cstr_t *cstr)
doLogToFile(uchar *ln, size_t lenLn)
{
struct iovec iov[4];
ssize_t nwritten;
@ -194,7 +196,7 @@ doLogToFile(cstr_t *cstr)
time_t t;
char timebuf[32];
if(cstrLen(cstr) == 0)
if(lenLn == 0)
goto done;
if(runModConf->logfd == -1) {
runModConf->logfd = open(runModConf->logfile, O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, S_IRUSR|S_IWUSR);
@ -210,9 +212,9 @@ doLogToFile(cstr_t *cstr)
iov[1].iov_base = ": ";
iov[1].iov_len = 2;
nexpect += 2;
iov[2].iov_base = rsCStrGetSzStrNoNULL(cstr);
iov[2].iov_len = (size_t) cstrLen(cstr);
nexpect += cstrLen(cstr);
iov[2].iov_base = ln;
iov[2].iov_len = lenLn;
nexpect += lenLn;
iov[3].iov_base = "\n";
iov[3].iov_len = 1;
nexpect++;
@ -226,6 +228,20 @@ done: return;
}
/* submit a line to our log destinations. Line must be fully formatted as
* required (but may be a simple verb like "BEGIN" and "END".
*/
static rsRetVal
submitLine(uchar *const ln, const size_t lenLn)
{
DEFiRet;
if(runModConf->bLogToSyslog)
doSubmitMsg(ln);
if(runModConf->logfile != NULL)
doLogToFile(ln, lenLn);
RETiRet;
}
/* callback for statsobj
* Note: usrptr exists only to satisfy requirements of statsobj callback interface!
*/
@ -233,10 +249,7 @@ static rsRetVal
doStatsLine(void __attribute__((unused)) *usrptr, cstr_t *cstr)
{
DEFiRet;
if(runModConf->bLogToSyslog)
doSubmitMsg(rsCStrGetSzStrNoNULL(cstr));
if(runModConf->logfile != NULL)
doLogToFile(cstr);
iRet = submitLine(rsCStrGetSzStrNoNULL(cstr), cstrLen(cstr));
RETiRet;
}
@ -281,6 +294,7 @@ CODESTARTbeginCnfLoad
loadModConf->logfile = NULL;
loadModConf->pszBindRuleset = NULL;
loadModConf->bLogToSyslog = 1;
loadModConf->bBracketing = 0;
loadModConf->bResetCtrs = 0;
bLegacyCnfModGlobalsPermitted = 1;
/* init legacy config vars */
@ -314,6 +328,8 @@ CODESTARTsetModCnf
loadModConf->iFacility = (int) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "severity")) {
loadModConf->iSeverity = (int) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "bracketing")) {
loadModConf->bBracketing = (sbool) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "log.syslog")) {
loadModConf->bLogToSyslog = (sbool) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "resetcounters")) {
@ -464,7 +480,11 @@ CODESTARTrunInput
while(glbl.GetGlobalInputTermState() == 0) {
srSleep(runModConf->iStatsInterval, 0); /* seconds, micro seconds */
DBGPRINTF("impstats: woke up, generating messages\n");
if(runModConf->bBracketing)
submitLine((uchar*)"BEGIN", sizeof("BEGIN")-1);
generateStatsMsgs();
if(runModConf->bBracketing)
submitLine((uchar*)"END", sizeof("END")-1);
}
ENDrunInput

4
plugins/imsolaris/imsolaris.c

@ -209,8 +209,8 @@ readLog(int fd, uchar *pRcv, int iMaxLine)
MsgSetInputName(pMsg, pInputName);
MsgSetRawMsg(pMsg, (char*)pRcv, strlen((char*)pRcv));
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
pMsg->iFacility = LOG_FAC(hdr.pri);
pMsg->iSeverity = LOG_PRI(hdr.pri);
pMsg->iFacility = pri2fac(hdr.pri);
pMsg->iSeverity = pri2sev(hdr.pri);
pMsg->msgFlags = NEEDS_PARSING | NO_PRI_IN_RAW;
CHKiRet(submitMsg(pMsg));
}

6
plugins/imuxsock/imuxsock.c

@ -6,7 +6,7 @@
*
* File begun on 2007-12-20 by RGerhards (extracted from syslogd.c)
*
* Copyright 2007-2013 Rainer Gerhards and Adiscon GmbH.
* Copyright 2007-2014 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@ -772,8 +772,8 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim
++parse;
++offs;
}
facil = LOG_FAC(pri);
sever = LOG_PRI(pri);
facil = pri2fac(pri);
sever = pri2sev(pri);
findRatelimiter(pLstn, cred, &ratelimiter); /* ignore error, better so than others... */

2
plugins/mmanon/mmanon.c

@ -295,7 +295,7 @@ anonip(instanceData *pData, uchar *msg, int *pLenMsg, int *idx)
int endpos;
int lenMsg = *pLenMsg;
while(i < lenMsg && (msg[i] <= '0' || msg[i] >= '9')) {
while(i < lenMsg && (msg[i] <= '0' || msg[i] > '9')) {
++i; /* skip to first number */
}
if(i >= lenMsg)

2
plugins/mmfields/mmfields.c

@ -43,7 +43,7 @@ MODULE_TYPE_NOKEEP
MODULE_CNFNAME("mmfields")
DEFobjCurrIf(errmsg);
DEFobjCurrIf(errmsg)
DEF_OMOD_STATIC_DATA
/* config variables */

14
plugins/omelasticsearch/omelasticsearch.c

@ -577,10 +577,10 @@ DBGPRINTF("omelasticsearch: %d items in reply\n", numitems);
"cannot obtain 'create' item for #%d\n", i);
ABORT_FINALIZE(RS_RET_DATAFAIL);
}
ok = cJSON_GetObjectItem(create, "ok");
if(ok == NULL || ok->type != cJSON_True) {
ok = cJSON_GetObjectItem(create, "status");
if(ok == NULL || ok->type != cJSON_Number || ok->valueint < 0 || ok->valueint > 299) {
DBGPRINTF("omelasticsearch: error in elasticsearch reply: "
"item %d, prop ok (%p) not ok\n", i, ok);
"item %d, status is %d\n", i, ok->valueint);
ABORT_FINALIZE(RS_RET_DATAFAIL);
}
}
@ -594,7 +594,7 @@ static inline rsRetVal
checkResult(wrkrInstanceData_t *pWrkrData, uchar *reqmsg)
{
cJSON *root;
cJSON *ok;
cJSON *status;
DEFiRet;
root = cJSON_Parse(pWrkrData->reply);
@ -606,8 +606,10 @@ checkResult(wrkrInstanceData_t *pWrkrData, uchar *reqmsg)
if(pWrkrData->pData->bulkmode) {
iRet = checkResultBulkmode(pWrkrData, root);
} else {
ok = cJSON_GetObjectItem(root, "ok");
if(ok == NULL || ok->type != cJSON_True) {
status = cJSON_GetObjectItem(root, "status");
/* as far as we know, no "status" means all went well */
if(status != NULL &&
(status->type == cJSON_Number || status->valueint >= 0 || status->valueint <= 299)) {
iRet = RS_RET_DATAFAIL;
}
}

15
plugins/ompgsql/ompgsql.c

@ -235,9 +235,18 @@ writePgSQL(uchar *psz, instanceData *pData)
if(bHadError || (PQstatus(pData->f_hpgsql) != CONNECTION_OK)) {
/* error occured, try to re-init connection and retry */
closePgSQL(pData); /* close the current handle */
CHKiRet(initPgSQL(pData, 0)); /* try to re-open */
bHadError = tryExec(psz, pData); /* retry */
int inTransaction = 0;
if(pData->f_hpgsql != NULL) {
PGTransactionStatusType xactStatus = PQtransactionStatus(pData->f_hpgsql);
if((xactStatus == PQTRANS_INTRANS) || (xactStatus == PQTRANS_ACTIVE)) {
inTransaction = 1;
}
}
if ( inTransaction == 0 ) {
closePgSQL(pData); /* close the current handle */
CHKiRet(initPgSQL(pData, 0)); /* try to re-open */
bHadError = tryExec(psz, pData); /* retry */
}
if(bHadError || (PQstatus(pData->f_hpgsql) != CONNECTION_OK)) {
/* we failed, giving up for now */
reportDBError(pData, 0);

1
plugins/omprog/omprog.c

@ -27,6 +27,7 @@
#include "config.h"
#include "rsyslog.h"
#include <stdio.h>
#include <syslog.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>

8
plugins/omudpspoof/omudpspoof.c

@ -383,7 +383,7 @@ UDPSend(wrkrInstanceData_t *pWrkrData, uchar *pszSourcename, char *msg, size_t l
if(len > 65528) {
DBGPRINTF("omudpspoof: msg with length %d truncated to 64k: '%.768s'\n",
len, msg);
(int) len, msg);
len = 65528;
}
@ -417,7 +417,7 @@ UDPSend(wrkrInstanceData_t *pWrkrData, uchar *pszSourcename, char *msg, size_t l
libnet_clear_packet(pWrkrData->libnet_handle);
/* note: libnet does need ports in host order NOT in network byte order! -- rgerhards, 2009-11-12 */
udp = libnet_build_udp(
ntohs(pWrkrData->sourcePort),/* source port */
pWrkrData->sourcePort, /* source port */
ntohs(tempaddr->sin_port),/* destination port */
pktLen+LIBNET_UDP_H, /* packet length */
0, /* checksum */
@ -455,7 +455,7 @@ UDPSend(wrkrInstanceData_t *pWrkrData, uchar *pszSourcename, char *msg, size_t l
* it is useful for consolidating with strace output.
*/
DBGPRINTF("omudpspoof: write error (total len %d): pktLen %d, sent %d, fd %d: %s\n",
len, LIBNET_IPV4_H+LIBNET_UDP_H+pktLen, lsent, pWrkrData->libnet_handle->fd,
(int) len, LIBNET_IPV4_H+LIBNET_UDP_H+pktLen, lsent, pWrkrData->libnet_handle->fd,
libnet_geterror(pWrkrData->libnet_handle));
if(lsent != -1) {
bSendSuccess = RSTRUE;
@ -504,7 +504,7 @@ UDPSend(wrkrInstanceData_t *pWrkrData, uchar *pszSourcename, char *msg, size_t l
lsent = libnet_write(pWrkrData->libnet_handle);
if(lsent != (int) (LIBNET_IPV4_H+pktLen)) {
DBGPRINTF("omudpspoof: fragment write error len %d, sent %d: %s\n",
LIBNET_IPV4_H+LIBNET_UDP_H+len, lsent, libnet_geterror(pWrkrData->libnet_handle));
(int) (LIBNET_IPV4_H+LIBNET_UDP_H+len), lsent, libnet_geterror(pWrkrData->libnet_handle));
bSendSuccess = RSFALSE;
continue;
}

2
plugins/sm_cust_bindcdr/Makefile.in

@ -35,7 +35,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = plugins/sm_cust_bindcdr
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
$(top_srcdir)/m4/atomic_operations_64bit.m4 \

10
plugins/sm_cust_bindcdr/README

@ -0,0 +1,10 @@
This module was created for a custom project with a very specific use
case. It was included into the source tree as a sample if someone
would like to create similar work. I strongly doubt it has any
value to the community other than serving as an example. Thus,
I do not intend to maintain this module, except if a sponsor
comes up that actually wants this to be done. I prefer to
leave it in the source tree even if it is broken starting with v8.
If that creates a problem, I would simply delete it.
Rainer Gerhards

3
rsyslog.service.in

@ -1,11 +1,14 @@
[Unit]
Description=System Logging Service
Requires=syslog.socket
Documentation=man:rsyslogd(8)
Documentation=http://www.rsyslog.com/doc/
[Service]
Type=notify
ExecStart=@sbindir@/rsyslogd -n
StandardOutput=null
Restart=on-failure
[Install]
WantedBy=multi-user.target

2
runtime/Makefile.am

@ -106,7 +106,7 @@ else
librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -D_PATH_MODDIR=\"$(pkglibdir)/\" -I\$(top_srcdir) -I\$(top_srcdir)/grammar
endif
#librsyslog_la_LDFLAGS = -module -avoid-version
librsyslog_la_CPPFLAGS += $(PTHREADS_CFLAGS) $(LIBUUID_CFLAGS) $(JSON_C_CFLAGS) -I\$(top_srcdir)/tools
librsyslog_la_CPPFLAGS += $(PTHREADS_CFLAGS) $(LIBUUID_CFLAGS) $(JSON_C_CFLAGS) ${LIBLOGGING_STDLOG_CFLAGS} -I\$(top_srcdir)/tools
librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS) $(LIBUUID_LIBS) $(JSON_C_LIBS)
#

8
runtime/Makefile.in

@ -583,7 +583,9 @@ librsyslog_la_SOURCES = \
@WITH_MODDIRS_FALSE@ -D_PATH_MODDIR=\"$(pkglibdir)/\" \
@WITH_MODDIRS_FALSE@ -I\$(top_srcdir) -I\$(top_srcdir)/grammar \
@WITH_MODDIRS_FALSE@ $(PTHREADS_CFLAGS) $(LIBUUID_CFLAGS) \
@WITH_MODDIRS_FALSE@ $(JSON_C_CFLAGS) -I\$(top_srcdir)/tools
@WITH_MODDIRS_FALSE@ $(JSON_C_CFLAGS) \
@WITH_MODDIRS_FALSE@ ${LIBLOGGING_STDLOG_CFLAGS} \
@WITH_MODDIRS_FALSE@ -I\$(top_srcdir)/tools
# the files with ../ we need to work on - so that they either become part of the
# runtime or will no longer be needed. -- rgerhards, 2008-06-13
#
@ -591,7 +593,9 @@ librsyslog_la_SOURCES = \
@WITH_MODDIRS_TRUE@librsyslog_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS \
@WITH_MODDIRS_TRUE@ -D_PATH_MODDIR=\"$(pkglibdir)/:$(moddirs)\" \
@WITH_MODDIRS_TRUE@ $(PTHREADS_CFLAGS) $(LIBUUID_CFLAGS) \
@WITH_MODDIRS_TRUE@ $(JSON_C_CFLAGS) -I\$(top_srcdir)/tools
@WITH_MODDIRS_TRUE@ $(JSON_C_CFLAGS) \
@WITH_MODDIRS_TRUE@ ${LIBLOGGING_STDLOG_CFLAGS} \
@WITH_MODDIRS_TRUE@ -I\$(top_srcdir)/tools
librsyslog_la_LIBADD = $(DL_LIBS) $(RT_LIBS) $(LIBUUID_LIBS) $(JSON_C_LIBS)
@ENABLE_REGEXP_TRUE@lmregexp_la_SOURCES = regexp.c regexp.h
@ENABLE_REGEXP_TRUE@lmregexp_la_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)

2
runtime/atomic.h

@ -221,7 +221,7 @@
return(val);
}
# define DEF_ATOMIC_HELPER_MUT64(x) pthread_mutex_t x
# define DEF_ATOMIC_HELPER_MUT64(x) pthread_mutex_t x;
# define INIT_ATOMIC_HELPER_MUT64(x) pthread_mutex_init(&(x), NULL)
# define DESTROY_ATOMIC_HELPER_MUT64(x) pthread_mutex_destroy(&(x))
#endif /* #ifdef HAVE_ATOMIC_BUILTINS64 */

49
runtime/msg.c

@ -125,7 +125,7 @@ static char *years[] = {
static struct {
uchar *pszName;
short lenName;
} syslog_pri_names[192] = {
} syslog_pri_names[200] = {
{ UCHAR_CONSTANT("0"), 3},
{ UCHAR_CONSTANT("1"), 3},
{ UCHAR_CONSTANT("2"), 3},
@ -317,22 +317,30 @@ static struct {
{ UCHAR_CONSTANT("188"), 5},
{ UCHAR_CONSTANT("189"), 5},
{ UCHAR_CONSTANT("190"), 5},
{ UCHAR_CONSTANT("191"), 5}
{ UCHAR_CONSTANT("191"), 5},
{ UCHAR_CONSTANT("192"), 5},
{ UCHAR_CONSTANT("193"), 5},
{ UCHAR_CONSTANT("194"), 5},
{ UCHAR_CONSTANT("195"), 5},
{ UCHAR_CONSTANT("196"), 5},
{ UCHAR_CONSTANT("197"), 5},
{ UCHAR_CONSTANT("198"), 5},
{ UCHAR_CONSTANT("199"), 5}
};
static char hexdigit[16] =
{'0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C', 'D', 'E', 'F' };
/*syslog facility names (as of RFC5424) */
static char *syslog_fac_names[24] = { "kern", "user", "mail", "daemon", "auth", "syslog", "lpr",
static char *syslog_fac_names[LOG_NFACILITIES] = { "kern", "user", "mail", "daemon", "auth", "syslog", "lpr",
"news", "uucp", "cron", "authpriv", "ftp", "ntp", "audit",
"alert", "clock", "local0", "local1", "local2", "local3",
"local4", "local5", "local6", "local7" };
"local4", "local5", "local6", "local7", "invld" };
/* length of the facility names string (for optimizatiions) */
static short len_syslog_fac_names[24] = { 4, 4, 4, 6, 4, 6, 3,
static short len_syslog_fac_names[LOG_NFACILITIES] = { 4, 4, 4, 6, 4, 6, 3,
4, 4, 4, 8, 3, 3, 5,
5, 5, 6, 6, 6, 6,
6, 6, 6, 6 };
6, 6, 6, 6, 5 };
/* table of severity names (in numerical order)*/
static char *syslog_severity_names[8] = { "emerg", "alert", "crit", "err", "warning", "notice", "info", "debug" };
@ -342,8 +350,8 @@ static short len_syslog_severity_names[8] = { 5, 5, 4, 3, 7, 6, 4, 5 };
* and facility values to a numerical string... -- rgerhars, 2009-06-17
*/
static char *syslog_number_names[24] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23" };
static char *syslog_number_names[LOG_NFACILITIES] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24" };
/* global variables */
#if defined(HAVE_MALLOC_TRIM) && !defined(HAVE_ATOMIC_BUILTINS)
@ -700,8 +708,8 @@ static inline rsRetVal msgBaseConstruct(msg_t **ppThis)
pM->flowCtlType = 0;
pM->bParseSuccess = 0;
pM->iRefCount = 1;
pM->iSeverity = -1;
pM->iFacility = -1;
pM->iSeverity = LOG_DEBUG;
pM->iFacility = LOG_INVLD;
pM->iLenPROGNAME = -1;
pM->offAfterPRI = 0;
pM->offMSG = -1;
@ -1544,7 +1552,10 @@ uchar *getMSG(msg_t * const pM)
/* Get PRI value as integer */
static int getPRIi(msg_t * const pM)
{
return (pM->iFacility << 3) + (pM->iSeverity);
int pri = (pM->iFacility << 3) + (pM->iSeverity);
if(pri > 191)
pri = LOG_PRI_INVLD;
return pri;
}
@ -2626,11 +2637,11 @@ void MsgSetRawMsgWOSize(msg_t * const pMsg, char* pszRawMsg)
char *textpri(char *pRes, int pri)
{
assert(pRes != NULL);
memcpy(pRes, syslog_fac_names[LOG_FAC(pri)], len_syslog_fac_names[LOG_FAC(pri)]);
pRes[len_syslog_fac_names[LOG_FAC(pri)]] = '.';
memcpy(pRes+len_syslog_fac_names[LOG_FAC(pri)]+1,
syslog_severity_names[LOG_PRI(pri)],
len_syslog_severity_names[LOG_PRI(pri)]+1 /* for \0! */);
memcpy(pRes, syslog_fac_names[pri2fac(pri)], len_syslog_fac_names[pri2fac(pri)]);
pRes[len_syslog_fac_names[pri2fac(pri)]] = '.';
memcpy(pRes+len_syslog_fac_names[pri2fac(pri)]+1,
syslog_severity_names[pri2sev(pri)],
len_syslog_severity_names[pri2sev(pri)]+1 /* for \0! */);
return pRes;
}
@ -4074,7 +4085,11 @@ MsgSetPropsViaJSON(msg_t *__restrict__ const pMsg, const uchar *__restrict__ con
err = tokener->err;
if(err != json_tokener_continue)
errMsg = json_tokener_errors[err];
# if HAVE_JSON_TOKENER_ERROR_DESC
errMsg = json_tokener_error_desc(err);
# else
errMsg = json_tokener_errors[err];
# endif
else
errMsg = "Unterminated input";
} else if(!json_object_is_type(json, json_type_object))

4
runtime/nsd_gtls.c

@ -1584,7 +1584,9 @@ finalize_it:
static rsRetVal
EnableKeepAlive(nsd_t *pNsd)
{
return nsd_ptcp.EnableKeepAlive(pNsd);
nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd;
ISOBJ_TYPE_assert(pThis, nsd_gtls);
return nsd_ptcp.EnableKeepAlive(pThis->pTcp);
}

8
runtime/parser.c

@ -620,11 +620,11 @@ ParsePRI(msg_t *pMsg)
}
if(*msg == '>')
++msg;
if(pri & ~(LOG_FACMASK|LOG_PRIMASK))
pri = DEFUPRI;
if(pri > LOG_MAXPRI)
pri = LOG_PRI_INVLD;
}
pMsg->iFacility = LOG_FAC(pri);
pMsg->iSeverity = LOG_PRI(pri);
pMsg->iFacility = pri2fac(pri);
pMsg->iSeverity = pri2sev(pri);
MsgSetAfterPRIOffs(pMsg, msg - pMsg->pszRawMsg);
}
RETiRet;

2
runtime/prop.h

@ -33,7 +33,7 @@ struct prop_s {
uchar sz[CONF_PROP_BUFSIZE];
} szVal;
int len; /* we use int intentionally, otherwise we may get some troubles... */
DEF_ATOMIC_HELPER_MUT(mutRefCount);
DEF_ATOMIC_HELPER_MUT(mutRefCount)
};
/* interfaces */

66
runtime/rsyslog.h

@ -3,7 +3,7 @@
*
* Begun 2005-09-15 RGerhards
*
* Copyright (C) 2005-2013 by Rainer Gerhards and Adiscon GmbH
* Copyright (C) 2005-2014 by Rainer Gerhards and Adiscon GmbH
*
* This file is part of the rsyslog runtime library.
*
@ -77,19 +77,58 @@
* # End Config Settings # *
* ############################################################# */
/* portability: not all platforms have these defines, so we
* define them here if they are missing. -- rgerhards, 2008-03-04
/* make sure we uses consistent macros, no matter what the
* platform gives us.
*/
#ifndef LOG_MAKEPRI
# define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
#endif
#ifndef LOG_PRI
# define LOG_PRI(p) ((p) & LOG_PRIMASK)
#endif
#ifndef LOG_FAC
# define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
#endif
#define LOG_NFACILITIES 24+1 /* plus one for our special "invld" facility! */
#define LOG_MAXPRI 191 /* highest supported valid PRI value --> RFC3164, RFC5424 */
#undef LOG_MAKEPRI
#define LOG_PRI_INVLD LOG_INVLD|LOG_DEBUG /* PRI is invalid --> special "invld.=debug" PRI code (rsyslog-specific) */
#define LOG_EMERG 0 /* system is unusable */
#define LOG_ALERT 1 /* action must be taken immediately */
#define LOG_CRIT 2 /* critical conditions */
#define LOG_ERR 3 /* error conditions */
#define LOG_WARNING 4 /* warning conditions */
#define LOG_NOTICE 5 /* normal but significant condition */
#define LOG_INFO 6 /* informational */
#define LOG_DEBUG 7 /* debug-level messages */
#define LOG_KERN (0<<3) /* kernel messages */
#define LOG_USER (1<<3) /* random user-level messages */
#define LOG_MAIL (2<<3) /* mail system */
#define LOG_DAEMON (3<<3) /* system daemons */
#define LOG_AUTH (4<<3) /* security/authorization messages */
#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
#define LOG_LPR (6<<3) /* line printer subsystem */
#define LOG_NEWS (7<<3) /* network news subsystem */
#define LOG_UUCP (8<<3) /* UUCP subsystem */
#define LOG_CRON (9<<3) /* clock daemon */
#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
#define LOG_FTP (11<<3) /* ftp daemon */
#define LOG_LOCAL0 (16<<3) /* reserved for local use */
#define LOG_LOCAL1 (17<<3) /* reserved for local use */
#define LOG_LOCAL2 (18<<3) /* reserved for local use */
#define LOG_LOCAL3 (19<<3) /* reserved for local use */
#define LOG_LOCAL4 (20<<3) /* reserved for local use */
#define LOG_LOCAL5 (21<<3) /* reserved for local use */
#define LOG_LOCAL6 (22<<3) /* reserved for local use */
#define LOG_LOCAL7 (23<<3) /* reserved for local use */
#define LOG_FAC_INVLD 24
#define LOG_INVLD (LOG_FAC_INVLD<<3) /* invalid facility/PRI code */
/* we need to use a function to avoid side-effects. This MUST guard
* against invalid facility values. rgerhards, 2014-09-16
*/
static inline int pri2fac(const int pri)
{
int fac = pri >> 3;
return (fac > 23) ? LOG_FAC_INVLD : fac;
}
static inline int pri2sev(const int pri)
{
return pri & 0x07;
}
/* the rsyslog core provides information about present feature to plugins
* asking it. Below are feature-test macros which must be used to query
@ -386,6 +425,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_CONF_WRN_FULLDLY_BELOW_HIGHWTR = -2358,/**< warning queue full delay mark below high wtr mark */
RS_RET_RESUMED = -2359,/**< status: action was resumed (used for reporting) */
RS_RET_RELP_NO_TLS = -2360,/**< librel does not support TLS (but TLS requested) */
RS_RET_STATEFILE_WRONG_FNAME = -2361,/**< state file is for wrong file */
/* up to 2400 reserved for 7.5 & 7.6 */
RS_RET_INVLD_OMOD = -2400, /**< invalid output module, does not provide proper interfaces */

1
runtime/srutils.c

@ -105,6 +105,7 @@ syslogName_t syslogFacNames[] = {
{"local5", LOG_LOCAL5},
{"local6", LOG_LOCAL6},
{"local7", LOG_LOCAL7},
{"invld", LOG_INVLD},
{NULL, -1},
};

5
runtime/syslogd-types.h

@ -4,7 +4,7 @@
*
* File begun on 2007-07-13 by RGerhards (extracted from syslogd.c)
*
* Copyright 2007-2012 Adiscon GmbH.
* Copyright 2007-2014 Adiscon GmbH.
*
* This file is part of the rsyslog runtime library.
*
@ -27,9 +27,6 @@
#include "stringbuf.h"
#include <sys/param.h>
#if HAVE_SYSLOG_H
#include <syslog.h>
#endif
/* we use RSTRUE/FALSE to prevent name claches with other packages */
#define RSFALSE 0

4
runtime/typedefs.h

@ -268,4 +268,8 @@ struct msgPropDescr_s {
int nameLen; /* properties (JSON) */
};
/* some forward-definitions from the grammar */
struct nvlst;
struct cnfobj;
#endif /* multi-include protection */

2
runtime/wti.h

@ -72,7 +72,7 @@ struct wti_s {
actWrkrInfo_t *actWrkrInfo; /* *array* of action wrkr infos for all actions
(sized for max nbr of actions in config!) */
pthread_cond_t pcondBusy; /* condition to wake up the worker, protected by pmutUsr in wtp */
DEF_ATOMIC_HELPER_MUT(mutIsRunning);
DEF_ATOMIC_HELPER_MUT(mutIsRunning)
struct {
uint8_t bPrevWasSuspended;
uint8_t bDoAutoCommit; /* do a commit after each message

4
runtime/wtp.h

@ -63,8 +63,8 @@ struct wtp_s {
rsRetVal (*pfDoWork)(void *pUsr, void *pWti);
/* end user objects */
uchar *pszDbgHdr; /* header string for debug messages */
DEF_ATOMIC_HELPER_MUT(mutCurNumWrkThrd);
DEF_ATOMIC_HELPER_MUT(mutWtpState);
DEF_ATOMIC_HELPER_MUT(mutCurNumWrkThrd)
DEF_ATOMIC_HELPER_MUT(mutWtpState)
};
/* some symbolic constants for easier reference */

37
tests/Makefile.am

@ -8,6 +8,11 @@ if ENABLE_IMDIAG
TESTS += \
stop-localvar.sh \
stop-msgvar.sh \
fac_authpriv.sh \
fac_local0.sh \
fac_mail.sh \
fac_news.sh \
fac_uucp.sh \
rfc5424parser.sh \
arrayqueue.sh \
global_vars.sh \
@ -128,6 +133,16 @@ TESTS += \
imptcp_conndrop.sh
endif
if ENABLE_ELASTICSEARCH
TESTS += \
elasticsearch-basic.sh \
elasticsearch-basic-bulk.sh \
elasticsearch-basic-errorfile-empty.sh \
elasticsearch-basic-errorfile-populated.sh \
elasticsearch-bulk-errorfile-empty.sh \
elasticsearch-bulk-errorfile-populated.sh
endif
if ENABLE_MMPSTRUCDATA
TESTS += \
mmpstrucdata.sh
@ -337,6 +352,16 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/global_vars.conf \
rfc5424parser.sh \
testsuites/rfc5424parser.conf \
fac_authpriv.sh \
testsuites/fac_authpriv.conf \
fac_local0.sh \
testsuites/fac_local0.conf \
fac_mail.sh \
testsuites/fac_mail.conf \
fac_news.sh \
testsuites/fac_news.conf \
fac_uucp.sh \
testsuites/fac_uucp.conf \
rs_optimizer_pri.sh \
testsuites/rs_optimizer_pri.conf \
rscript_prifilt.sh \
@ -362,6 +387,18 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
incltest_dir_wildcard.sh \
testsuites/incltest_dir_wildcard.conf \
testsuites/incltest.d/include.conf \
elasticsearch-basic.sh \
testsuites/elasticsearch-basic.conf \
elasticsearch-basic-bulk.sh \
testsuites/elasticsearch-basic-bulk.conf \
elasticsearch-basic-errorfile-empty.sh \
testsuites/elasticsearch-basic-errorfile-empty.conf \
elasticsearch-basic-errorfile-populated.sh \
testsuites/elasticsearch-basic-errorfile-populated.conf \
elasticsearch-bulk-errorfile-empty.sh \
testsuites/elasticsearch-bulk-errorfile-empty.conf \
elasticsearch-bulk-errorfile-populated.sh \
testsuites/elasticsearch-bulk-errorfile-populated.conf \
linkedlistqueue.sh \
testsuites/linkedlistqueue.conf \
da-mainmsg-q.sh \

62
tests/Makefile.in

@ -49,11 +49,17 @@ host_triplet = @host@
@ENABLE_TESTBENCH_TRUE@ $(am__append_9) $(am__append_10) \
@ENABLE_TESTBENCH_TRUE@ $(am__append_11) $(am__append_12) \
@ENABLE_TESTBENCH_TRUE@ $(am__append_13) $(am__append_14) \
@ENABLE_TESTBENCH_TRUE@ $(am__append_15) $(am__append_16)
@ENABLE_TESTBENCH_TRUE@ $(am__append_15) $(am__append_16) \
@ENABLE_TESTBENCH_TRUE@ $(am__append_17)
#TESTS = $(TESTRUNS) cfg.sh
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_1 = \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ stop-localvar.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ stop-msgvar.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_authpriv.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_local0.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_mail.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_news.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_uucp.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rfc5424parser.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ arrayqueue.sh \
@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ global_vars.sh \
@ -164,10 +170,18 @@ host_triplet = @host@
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_addtlframedelim.sh \
@ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_conndrop.sh
@ENABLE_MMPSTRUCDATA_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_7 = \
@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_7 = \
@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic.sh \
@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic-bulk.sh \
@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic-errorfile-empty.sh \
@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic-errorfile-populated.sh \
@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-bulk-errorfile-empty.sh \
@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-bulk-errorfile-populated.sh
@ENABLE_MMPSTRUCDATA_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_8 = \
@ENABLE_MMPSTRUCDATA_TRUE@@ENABLE_TESTBENCH_TRUE@ mmpstrucdata.sh
@ENABLE_MMJSONPARSE_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_8 = \
@ENABLE_MMJSONPARSE_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_9 = \
@ENABLE_MMJSONPARSE_TRUE@@ENABLE_TESTBENCH_TRUE@ mmjsonparse_simple.sh \
@ENABLE_MMJSONPARSE_TRUE@@ENABLE_TESTBENCH_TRUE@ mmjsonparse_cim.sh