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>
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>
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>