messages: add msg_warning_once() macro

This patch implements msg_warning_once() macro, that causes the warning
to be printed once per syslog-ng execution. This pattern is being
used at a number of places in syslog-ng, but so far has been open-coded
at all sites. This macro makes it possible to refactor all such sites,
reducing the code considerably.

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
global: use msg_warning_once() instead of open coding the same

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
cfg: display warning about duplicate configuration elements only once

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
afmongodb: remove exclamation from warning messages

All other warning call sites use WARNING: and not WARNING!, do the same in
the mongo driver too.

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
dbparser: only display the change in inject-mode() once per startup

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
Merge branch 'f/3.6/msg-warning-refactor' into 3.6/master

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
cfg-tree: increase buffer for formatting the location in debug messages

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
cfg-tree: add log_expr_node_location_tag() function

This new function formats a "location" tag to be emitted as a name-value
pair associated with an internal message. This makes it trivial
to add this information to internal messages.

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
logpipe: add log_pipe_location_tag() function

This function formats a "location" tag to be emitted as a name-value
pair of internal messages.

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
global: use log_pipe_location_tag() and log_expr_node_location_tag()

Signed-off-by: Balazs Scheidler <bazsi@balabit.com>
Merge branch 'f/3.6/location-tag-refactor' into 3.6/master

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
templates.h: add inclusion of plugin.h

Macros in templates.h may use the plugin API, which is thus a dependency,
include that so that the call-site doesn't need to.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
test_template_compile: create get_template_function_ops()

This new function makes it easier to describe LTE_FUNC elements.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
templates.c: extract log_template_prepare_function_call()

In order to make log_template_add_func_elem() easier to read (and to prepare
a new feature there), extract log_template_prepare_function_call()
that sets up the template function invocation given the implementing
plugin.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
templates.c: extract log_template_lookup_and_setup_function_call()

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Merge branch 'f/3.6/template-related-refactors' into 3.6/master

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
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>