371 Commits

Author SHA1 Message Date
Rainer Gerhards
7c4adc5598 imdiag bugfix: double mutex unlock
This was caused by double-evaluation of a macro argument; macro changed

Detected by Coverity scan, CID 185348 and 185350
2017-11-01 17:12:54 +01:00
Rainer Gerhards
7b5b00a759 core/msg: refactor locking for json variable access
refactored the method so that it consistent in all functions and easier
to follow. Most importantly, now an as simple as possible locking paradigm
of lock ... unlock within the function. Hopefully easier to understand
both for humans and static code analyzers.
2017-11-01 13:12:57 +01:00
Rainer Gerhards
4798212040 work around clang static analyzer false positives 2017-10-24 11:23:33 +02:00
Rainer Gerhards
4cbebce23d Merge commit 'b8863c2a6a879e54fccae50209ec285ccbe712dd' into merge-961 2017-10-22 15:29:23 +02:00
Rainer Gerhards
7c273a3314 core: emit error message on abnormal input thread termination
this in almost all cases indicates a real problem that the user
should be made aware of

For a case where the missing error message caused confusion
see also https://github.com/rsyslog/rsyslog/issues/1867
2017-10-20 09:22:45 +02:00
Rainer Gerhards
26ef28cfd2 build: add macro to support new FALLTHROUGH checks in gcc7
We add a macro to provide better cross-platform compatibility.
We also intend to do this for other attribues as well.
2017-10-19 13:09:28 +02:00
Rainer Gerhards
57a7c281ff omfwd bugfix: UDP oversize message not properly handled
When a message larger than supported by the UDP stack is to be sent,
EMSGSIZE is returned, but not specifically handled. That in turn
will lead to action suspension. However, this does not make sense
because messages over the UDP max message size simply cannot be sent.

This patch truncates the message in question and reports an error
message with the condition.

closes https://github.com/rsyslog/rsyslog/issues/1654
2017-09-11 12:53:54 +02:00
Rainer Gerhards
fd0c46f071 Merge pull request #1705 from jgerhards/newdbg
add debug.file and debug.whitelist parameters
2017-08-08 14:30:40 +02:00
Jan Gerhards
edfc4396a3 core: add parameters debug.file and debug.whitelist
allows to generate debug log output only of specific files
2017-08-08 12:12:39 +02:00
Rainer Gerhards
14c939af1f queue: provide informational messges on thread startup and shutdown
This provides better insight into operational state of rsyslog and is useful
in monitoring system health.
2017-08-01 17:43:32 +02:00
PascalWithopf
b7c32be2af MsgSetPropsViaJSON: Possibility to give a json object as parameter instead of a string 2017-07-19 08:56:32 +02:00
Rainer Gerhards
9f95005ebf Merge pull request #1511 from PascalWithopf/solaris
workaround for solaris testbench
2017-04-13 16:20:55 +02:00
Rainer Gerhards
8d67c03d45 solaris: fix coding issues 2017-04-11 10:18:42 +02:00
PascalWithopf
e94e8beede omfile: add error if both file and dynafile are set
also adds a test.
closes https://github.com/rsyslog/rsyslog/issues/1346
2017-03-28 14:26:28 +02:00
Rainer Gerhards
cd51ae3647 core: enable internal messages at any time
previous code could deadlock if internal messages were issued
inside queue processing code, which effectively limited
error-reporting capabilities. This change makes it possible
to call error messages from any part of the code at any time.
This comes at the price of slightly delayed message output.
2017-03-07 09:27:49 +01:00
Rainer Gerhards
efbd6f964a core: add error message if configured directory owner cannot be set
closes https://github.com/rsyslog/rsyslog/issues/1396
2017-02-08 15:24:34 +01:00
Pascal Withopf
b63a6b9010 codestyle: line length adjusted 2017-01-17 08:54:37 +01:00
purnima
d45daa2af0 Rebase,redefine msgDestruct() as smsg_t is used 2016-11-22 14:24:25 +05:30
Janmejay Singh
671989350e fixed a few memory leaks and covered omprog cleanup with valgrind (one of the leaks affects any non-tx string-passing action) 2016-11-03 23:48:43 +05:30
Rainer Gerhards
61c401a982 rsyslog.conf: provide a capability to set environment variables
We should provide a vehicle to set environment variables via the
config file. This is most importantly for things like HTTP_PROXY.
Currently, to do this system startup files need to be modified,
which is cumbersome and different from platform to platform.

closes https://github.com/rsyslog/rsyslog/issues/1209
2016-10-20 15:22:43 +02:00
Janmejay Singh
d9a182589e error check lookup table initialization (improves initialization error checking rigour) 2016-10-14 02:08:41 +05:30
Rainer Gerhards
51c03c66e0 make inline functions C99-compliant
As it seems, different C compilers have different rules/interpretations
on inline functions. The current code base did not properly obey all C99
rules. We fix this by converting some functions to macros and others to
include the necessary C99 plumbing. We also remove some inline attributes
for functions where this seems to be to agressive (aka "function to big").

This fixes build problems in some environments and is a general code
cleanup measure.
2016-09-05 16:47:14 +02:00
Rainer Gerhards
24bab3b108 queue subsystem: .qi file is automically rewritten
previously, a kill -9 during the .qi write could keep the file
in inconsistent state. Now, we first write a temp file, and
(automically) rename it to "the real thing". So if something happens
during writing the .qi, at least the old state still is consistent.

This is inspired by the way the pid file is handled sind v8.19.
2016-08-22 16:20:02 +02:00
Rainer Gerhards
aa0056dcba bugfix omfile: handle chown() failure correctly
If the file creation succeeds, but chown() failed, the file was
still writen, even if the user requested that this should be treated
as a failure case. This is corrected by this commit.

Alos, some refactoring was done to create better error messages.
2016-07-04 11:47:56 +02:00
Peter Portante
b8863c2a6a Create a constant for @cee: 2016-06-22 03:03:46 +00:00
Rainer Gerhards
5ee6e4f8e9 core: fix bug in old-style transactional interface emulation 2016-06-21 14:19:33 +02:00
Rainer Gerhards
3a5ff24abf turn off some gcc warnings
we probably re-enable some of them later on again
2016-06-02 17:34:32 +02:00
Rainer Gerhards
4ac258360c fix gcc compiler warnings (in pretty strict mode) 2016-06-02 17:06:45 +02:00
Rainer Gerhards
5e3b075d53 fix compiler warnings 2016-06-02 12:08:55 +02:00
Rainer Gerhards
070d987a45 fix compiler warnings 2016-06-01 09:49:46 +02:00
Rainer Gerhards
8e4bfe19b5 core: set default stack size to 4MiB
Note that this is below the usual 10MiB default, but should cause
no issues (output threads already use 4MiB stack size, for example).
This also addresses issues introduced by micro-libc's which only
provide very limited stack space by default.

closes https://github.com/rsyslog/rsyslog/issues/996
2016-04-29 10:10:29 +02:00
Rainer Gerhards
accfa81e5d cleanup: remove compatibility checks for old json-c
as we now use libfastjson, we do no longer need to check for "new"
features, as these are always present in libfastjson (things
like json_object_object_get_ex()).

closes https://github.com/rsyslog/rsyslog/issues/935
2016-04-05 12:16:09 +02:00
Rainer Gerhards
f0121417c1 fix $PrivDropToGrop error handling
closes https://github.com/rsyslog/rsyslog/issues/906
2016-03-24 17:55:33 +01:00
Rainer Gerhards
0e17c41aa5 imfile: fix race during startup that could lead to some duplication
If a to-be-monitored file was created after inotify was initialized
but before startup was completed, the first chunk of data from this
file could be duplicated. This should have happened very rarely in
practice, but caused occasional testbench failures.

closes https://github.com/rsyslog/rsyslog/issues/791
2016-02-16 12:55:11 +01:00
Rainer Gerhards
c7b455524b add "senders.reportNew" global parameter 2016-02-01 17:27:11 +01:00
Rainer Gerhards
c0736fe344 emit warning if sender has not been seen for a period of time
controllable via
   global(senders.reportGoneAway="on" senders.timeoutAfter="10")

see also https://github.com/rsyslog/rsyslog/issues/751
2016-02-01 15:07:32 +01:00
Rainer Gerhards
40d030d2c7 Merge branch 'master' of https://github.com/janmejay/rsyslog into master-merge-imptcp
Conflicts:
	plugins/imptcp/imptcp.c
	tests/Makefile.am
	tests/tcpflood.c
2016-01-28 11:20:04 +01:00
Rainer Gerhards
51be5bef2d Merge branch 'unhandled-inotify-init-faild' of https://github.com/jopstools/rsyslog into master-candidate 2016-01-13 10:24:31 -05:30
Zhiyong Zhao
eddf173e53 Handling the condition of inotify instance's failed initialization 2016-01-12 12:41:09 +08:00
Peter Portante
b7d7fc72e7 Check memory allocation of json return values
We drop the use of the RS_*_ext macro since it is only used in one
place, and this change allows us to only perform the json-c call under
the mutex, and not the strdup() as well.  We add checks for NULL from
json_*_string and strdup().
2015-12-19 16:15:33 +00:00
Janmejay Singh
49df782820 moved from O(worker) assignment model to queue based model for imptcp io-work 2015-10-28 14:42:35 +05:30
Rainer Gerhards
776261be49 mmnormalize: liblognorm error messages are now reported
This is possible due to a new API in liblognorm 1.1.2;
Note that the amount of error messages depends on the version of
liblognorm used. Consequently, liblognorm 1.1.2 is now required
to run mmnormalize.
2015-07-28 15:22:05 +02:00
Rainer Gerhards
c90bf46183 KSI: basic adaption to new API 2015-06-26 08:57:34 +02:00
Michael Biebl
6fbacdc41d typo fix: paramter → parameter
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772490
2015-06-08 20:23:01 +02:00
Rainer Gerhards
fd499cf64b bugfix: build system strndup was used even if not present
now added compatibility function. This came up on Solaris builds.
Thanks to Dagobert Michelsen for reporting the problem.
closes https://github.com/rsyslog/rsyslog/issues/347
2015-05-20 18:27:43 +02:00
Dustin Koupal
51b766c33c fixing json formatting when using json-c < 0.10 2015-04-22 18:15:01 +00:00
Rainer Gerhards
d849fd6d88 omprog: enhance HUP processing
we can now specify which signal (for a valid set) is to be
sent on HUP

see also https://github.com/rsyslog/rsyslog/issues/281
2015-03-31 17:13:01 +02:00
Rainer Gerhards
597894e768 plumbing to re-instantiate the $AbortOnUncleanConfig functionality
This makes rsyslog abort if any error message occured during config
processing. Howerver, this is too strict, because some messages are
really just warnings (like queue sizes too low) and do not cause
an unclean config. Nevertheless, these warnings are logged as errors
currently. So a full review and cleanup of emitted error messages
is necessary.

see also https://github.com/rsyslog/rsyslog/issues/78
2015-02-24 13:05:49 +01:00
Janmejay Singh
35e7f12a2c fixing the condition for negative case, it was broken because the returned value was TRUE for a failed value dereference 2015-01-20 20:43:08 +05:30
Janmejay Singh
2064e7796b Mysterious bug which surfaced on Ubuntu-12.04 was caused by old json_object_object_get api exposed by json-0.9 which tried to use json_object as linked-hashtable without checking its type (o_type) first. Added the check in RS_json_object_object_get_ex to fix it. 2015-01-20 20:43:08 +05:30