basicfuncs: Use gint64 instead of glong

Since parse_number was modified earlier to always use gint64, on 32 bit
platforms, basicfuncs that used parse_number() were broken, because they
were not migrated to gint64 yet. This patch fixes that, by converting
all relevant glongs to gint64.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
contrib/systemd: Correctly require syslog.socket

In order to make sure that the Journal forwards syslog messages to us,
we need to require syslog.socket. We also do not need to list it as our
own.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
versioning: introduce syslog-ng version 3.7

This patch changes the default config version to 3.7 and adds related
defines.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
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>
modules: Do not count inserted/sent messages as stored ones.

Stored messages are for only queued messages inside syslog-ng.
Merge pull request #198 from talien/f/do-not-count-inserted-messages-as-stored

modules: Do not count inserted/sent messages as stored ones.

This also fixes #142.
lib/cfg.c: Increase the default flush_lines value

The default setting for flush_lines was 0, which meant different things
to different drivers, but was mostly equal to flush-lines(1).

This addresses the other part of #62.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
logthrdestdrv: Move SEQNUM handling here

Instead of handling SEQNUM in all the various drivers that use
LogThreadedDestDriver, move the functionality into the class itself.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
logthrdestdrv: Implement SEQNUM persistence

With this change, LogThreadedDestDriver will store SEQNUM in the persist
file, so we won't start from one again after a reload or a restart. The
key used for storing is the driver-supplied persist_name plus ".seqnum"
appended.

We do the persisting at deinit, and the loading in driver start. We
can't do it at init time, because the formatting function is not set
there yet. Fortunately, we do not need the SEQNUM between init and
start, so we can do it at a later time.

This fixes #178.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #200 from algernon/f/3.6/logthr-seqnum

SEQNUM persistence for LogThreadedDestDriver modules
logthrdestdrv: Use log_queue_backlog_*()

Instead of using log_msg_ack() and friends, use the log_queue_backlog
family of functions to accept or drop a message, or to rewind the queue.

All users of LogThreadedDestDriver updated, and now they all use the
same mechanism.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
mongodb: Do not disable throttle()

Throttling was implemented in LogThrDestDriver, and as such, the MongoDB
driver gained support for it too. Therefore, we do not need to disable
it anymore.

This fixes #180.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
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 pull request #207 from balabit/f/template-related-refactors

F/template related refactors
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>