129 Commits

Author SHA1 Message Date
purnima
d45daa2af0 Rebase,redefine msgDestruct() as smsg_t is used 2016-11-22 14:24:25 +05:30
Rainer Gerhards
fdd9de9626 bugfix: potential hang on rsyslog startup
When we log internal messages to syslog (the default starting with 8.21),
early error messages can result in rsyslogd hanging, as well as everything
else that wants to log hanging.

This is the result of deadlock: rsyslog tries to write to the log socket,
which blocks but can't be unblocked as rsyslog processing would need to
advance to do so. Interestingly, this only happens occasionally (even
though the startup sequence is deterministic at this point), so it is
hard to diagnose. Also, not all platforms seem to be affected. Platforms
with systemd journal will never run into a deadlock (as journal in this
case reads the system log socket).

The root cause is that for internal messages we maintain a queue for
such early messages and emit them only after full startup. Similar code
is missing when writing to the log socket. The full code has been
restructured so that this condition is obeyed under all conditions.

closes https://github.com/rsyslog/rsyslog/issues/1188
2016-10-14 09:13:55 +02:00
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
8a8675b223 fix compiler warnings 2016-06-02 10:18:05 +02:00
Rainer Gerhards
0fcad0ddd4 core: simplify locking for variable access 2016-01-27 13:00:41 +01:00
Rainer Gerhards
80d0ad708b convert JSON strings inside execution engine to native strings
they can be processed much faster
2015-11-13 12:34:44 +01:00
Rainer Gerhards
71f0afb9ef json vars: we need full locks even for read operations
closes https://github.com/rsyslog/rsyslog/issues/570
2015-11-03 17:07:03 +01:00
Rainer Gerhards
023becabd7 protect json variable access by read-write-lock
json-c objects cannot be used on multiple threads and so we
need to guard against this. Note that this was already handled
in many cases by totally locking the message, what we now do
no longer. So all in all, it could even improve performance for
configs where json is used. For others, it slightly decreases,
because we need to initialize the rwlocks for each message.
2015-11-03 17:07:03 +01:00
Tomas Heinrich
f7a6bf7553 msg_t: ensure proper termination of pszRawMsg
MsgSetRawMsg() always enforces termination by a zero
byte. MsgSetRawMsgSize() is used in SanitizeMsg() in a way that
suggests zero-temination.  Amend MsgSetRawMsgSize() to be consistent
with the semantics of MsgSetRawMsg().
2015-06-08 19:38:46 +02:00
Janmejay Singh
15afe8245f created param in add-flow to indicate if a graph being added to global-variable is shared, so it can be deep-copied instead of referenced (external modifications to which can not be protected from unsafe concurrent access) + killed an unused function 2015-05-26 09:41:35 +05:30
Rainer Gerhards
2a314e8e61 make imfile emit filname metadata and begin metadata system
- add message metadata "system" to msg object
  this permits to store metadata alongside the message
- imfile: add support for "filename" metadata
  this is useful in cases where wildcards are used

see also https://github.com/rsyslog/rsyslog/issues/199
2015-01-09 12:14:28 +01:00
Janmejay Singh
4ca5e217e2 Adds support for 'reset' statement (it has syntax similar to set 'set', but _unlike_ 'set' always force-sets the given value insteed of conditionally merging it, or not saving it because it is trying to replace an object with a leaf value etc).
Syntax:

reset $.foo = $!bar;

etc.
2014-12-17 11:39:31 +01:00
Janmejay Singh
9c28cc9955 support for addressing json array members 2014-12-17 11:39:30 +01:00
Rainer Gerhards
a407348963 refactor PRI-handling code 2014-10-08 12:50:10 +02:00
Rainer Gerhards
196c6c8e74 undo interface changes to getTime* functions
I originally thought that I would need to do dynamic memory
alloc and extended the interface to support this. Fortunatley,
this could be avoided, and so I undo that change now.
2014-04-30 12:01:01 +02:00
Rainer Gerhards
25e8881d95 add date-wdayname property modifier
see also: https://github.com/rsyslog/rsyslog/issues/65
2014-04-29 13:13:51 +02:00
Rainer Gerhards
f860025bd4 mmexternal: support "json" inbound message passing 2014-04-08 12:24:28 +02:00
Rainer Gerhards
3d4496c583 Merge branch 'v8-stable'
Conflicts:
	runtime/msg.h
2014-04-04 18:43:36 +02:00
Rainer Gerhards
5a92054bdf apply a couple of (useful) "const" attributes
The primary reason is to avoid unnecessary merge conflicts
when merging up to newer code, which more insist on the
"const correctness" - but we may get some optimizer benefits
as well.
2014-04-04 15:02:56 +02:00
Rainer Gerhards
90e2a1a8df add modifiable properties to external message modification module interface
The set is still incomplete, but I noticed that it is better to add some
"const" definitions to older versions (probably v7-stable) before
continuing.
2014-04-04 08:19:14 +02:00
Rainer Gerhards
a7c6b9cde5 milestone/mmexternal: support replacing msg property, fix stall in mmexternal 2014-03-17 08:00:21 +01:00
Rainer Gerhards
0dd121d65b milestone/mmexternal: permit update to rawmsg property
this is the first PoC
2014-03-16 17:42:00 +01:00
Rainer Gerhards
f458911955 introduce new API for modifying message object (just a skeleton) 2014-03-09 18:35:41 +01:00
Rainer Gerhards
5cddb0533b fix VAR handling in script grammar and code
The $-var designator is now correctly stripped off the varname.
2013-10-23 17:29:04 +02:00
Rainer Gerhards
059a316824 refactor: align jsonFind() calling interface with recent changes 2013-10-23 15:59:23 +02:00
Rainer Gerhards
b5a5041d75 minor cleanup 2013-10-23 15:53:49 +02:00
Rainer Gerhards
e93ebb79db refactor: remove now no-longer needed functions 2013-10-23 15:50:42 +02:00
Rainer Gerhards
c0f4474389 refactor get.*PropVal() series of functions 2013-10-23 15:12:30 +02:00
Rainer Gerhards
eb9adf9baa refactor: simplify JSON variable access 2013-10-23 13:08:56 +02:00
Rainer Gerhards
7d39740b3d refactor: use common code for message property description processing
in all cases except script var access -- this comes next...
2013-10-22 17:55:35 +02:00
Rainer Gerhards
7a15d40a42 refactor: somewhat simplify property-name-to-id mapping 2013-10-21 17:22:32 +02:00
Rainer Gerhards
f4f2a493b0 work a bit toward string handling unification 2013-10-21 17:12:07 +02:00
Rainer Gerhards
a8b1e96d7b Merge branch 'v7-stable-mmrfc5424addhmac'
Conflicts:
	Makefile.am
	configure.ac
	runtime/msg.c
	runtime/rsyslog.h
2013-09-26 12:41:50 +02:00
Rainer Gerhards
039e23df84 Merge branch 'v7-stable' 2013-09-26 12:37:36 +02:00
Rainer Gerhards
3b78f4c50c remove no-longer needed data item 2013-09-25 17:30:19 +02:00
Rainer Gerhards
b810f0dd3a mmrfc5424addhmac: complete initial implementation
hash is now also persisted back to structured-data rsyslog
property
2013-09-25 17:15:58 +02:00
Rainer Gerhards
c787fb9ce9 simplify STRUCTURED-DATA representation in msg object 2013-09-25 16:48:21 +02:00
Rainer Gerhards
593c8e41d1 milestone: mmpstrucdata parses STRUCTURED-DATA (but does not yet store it) 2013-09-23 16:10:12 +02:00
Rainer Gerhards
90e1478f11 expose so-far msg-internal method to query structured data
This also lead to a slight performance optimization in the msg.c
module (when it comes to querying structured data).

This is stage work in order to provide the capability to fully
parse structured data.
2013-09-23 12:47:21 +02:00
Rainer Gerhards
d5f3ab3117 mmrfc5424addhmac milestone: do not process non-rfc5424 messages 2013-09-23 12:15:15 +02:00
Rainer Gerhards
8d4a5152cb Merge branch 'v7-stable' 2013-09-03 11:54:20 +02:00
hwoarang
1c71b9628b make rsyslog use the new json-c pkgconfig file if available 2013-09-03 11:38:01 +02:00
Rainer Gerhards
743a2ddf9f Merge branch 'c9'
Conflicts:
	runtime/msg.c
2013-09-02 12:34:46 +02:00
Rainer Gerhards
d11e8221a8 milestone: defaultTZ can be set in msg obj (via imtcp)
... but parser does not yet use it.
2013-08-30 18:29:46 +02:00
Rainer Gerhards
4ecd6bb946 first shot at global variables (without proper sync so far) 2013-07-22 17:38:31 +02:00
Rainer Gerhards
4c2bef51d1 milestone: basic local variable functionality available
but some nits, like do not work with disk queues
2013-07-17 11:37:53 +02:00
Rainer Gerhards
d4ca9a48d6 refactor in preparation of local variables
local variables require a second json root; this refactoring makes
sure we can basically use common functions for json handling
2013-07-17 09:47:14 +02:00
Tomas Heinrich
b424b8c249 Don't #include libestr and libee headers when not necessary
Through msg.h, many unrelated components needlessly required
LIBEE_CFLAGS.
2013-05-20 21:32:49 +02:00
Rainer Gerhards
a6aa2b75ee mmanon: complete ipv4 functionality 2013-03-04 12:59:53 +01:00
Rainer Gerhards
47e11d68b2 optimize: obtaining programname
included some additional refactoring for cleaner code
2013-01-14 13:44:36 +01:00