lib/compat/time.h: CLOCK_MONOTONIC compatibility

Instead of using CLOCK_MONOTONIC unconditionally, define it to
CLOCK_REALTIME if it is not already defined. This definition goes into
lib/compat/time.h, which is included instead of <time.h> in
lib/timeutils.h, which is in turn included by all users that use
CLOCK_MONOTONIC.

This fixes #174.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
type-hint: add a more descriptive error when a type hint is unknown

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
value-pairs: stricter type hint parsing

Type hints can only consists of alphabetic characters.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
system-source: parse @cim marked messages by json-parser automatically

This allows any local applications to submit JSON formatted messages
through the syslog() API, which will automatically be parsed. A ".cim."
prefix will be added to the fields extracted.

The same values can be reconstructed using a value-pairs expression,
something like:

  $(format-json --key .cim.* --shift 5)

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
Merge branch 'f/3.6/parse-cim-json-messages-in-system' into 3.6/master

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #215 from algernon/f/3.6/type-hints/strict-parsing

Stricter type hint parsing
Merge pull request #214 from algernon/h/3.6/clock-monotonic

lib/compat/time.h: CLOCK_MONOTONIC compatibility
logthrdestdrv: Centralize the retries() functionality

Instead of implementing retries() for each driver, implement it once, in
LogThrDestDriver. This changes the API of worker->insert: it now
receives the message, and must return one of a number of resulting
states. The parent class will handle it from there. All derived drivers
were updated.

This fixes #201, and due to centralization and common behaviour, also
fixes #202 too.

As a side effect, this adds retries() functionality to amqp(), stomp()
and redis().

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
logthrdestdrv: Introduce threaded_dest_driver_option

This new rule in the grammar will hold all the options that are
centrally implemented by LogThrDestDriver. Currently, this is the
retries() option.

With the function moved to that class, the setter was moved there too,
and all copies were removed from the various drivers.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
cfg-parser: Move "retries" from afsql to cfg-parser

Now that "retries" is implemented by something in core too, move
associated things to cfg-parser.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
logthrdestdrv: Lift a function out of _do_work()

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
logthrdestdrv: Insert as much as we can

In log_threaded_dest_driver_do_insert(), loop while log_queue_pop_head()
returns TRUE (or we need to suspend), so that we don't do a sleep/wakeup
cycle for every single message. We can do this without blocking anyone
else, because this function is running in a dedicated thread.

Thanks to Viktor Juhasz for the suggestion!

Suggested-by: Viktor Juhasz <viktor.juhasz@balabit.com>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
logthrdestdrv: Refactor the inner insert loop

Instead of locally keeping track of suspension, move that to
LogThrDestDriver->suspended, and set that to TRUE in
_disconnect_and_suspend(), and back to FALSE in _do_work().

This way the control flow is easier to follow, and re-registering can be
moved to _do_work() from _do_insert().

Requested-by: Viktor Juhasz <viktor.juhasz@balabit.com>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #204 from algernon/f/3.6/central-retries

Centralised retries() for LogThrDestDriver
Add a contributors guide

This adds a CONTRIBUTING.md file, a guide for contributors. Fixes #205.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #211 from algernon/f/CONTRIBUTING.md

Add a contributors guide, fixes #205.
Merge remote-tracking branch 'balabit/3.6/master'

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>