system-source: Fix the copyright headers

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
afsocket: Warn & auto-migrate when using /dev/log under systemd

We were emitting a warning when /dev/log was in use, yet, we were
running under systemd, but only when the config version was older than
3.4. Due to various circumstances, lets extend that so it warns on 3.5
too.

Requested-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
filter: Allow in-list("FILE", value("MACRO"))

While the in-list("FILE", value("MACRO")) syntax was documented in the
commit message, it was not actually supported. This patch implements
that syntax too.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
afstomp: Make it depend on libsyslog-ng.la

For parallel builds, depend on ${MODULE_DEPS_LIBS}, to avoid a race
condition.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Fix a crash when an invalid scope is specified

Terminate the list of scopes with empty values, so we reach the stop
condition instead of overflowing.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
templates: Initial support for on-error()

This implements low-level support for the on-error() setting, making it
possible to set it globally in options{}, and making inheritance work,
so that it can be overridden later on.

Valid values are: drop-message, drop-property and
fallback-to-string (this latter one is only valid for type hinting,
though!), optionally prefixed by "silently-".

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
cfg-grammar: remove type info from options_item

It doesn't really return values, so don't declare types.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg-grammar.y: introduce separate rule for LogTemplateOptions

In order to use common rules to parse template related options, introduce
a separate rule for parsing stuff into LogTemplateOptions.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
templates: constify LogTemplateOptions

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
affile: use common code to parse template specific options

This patch converts affile to use the template_option rule in cfg-grammar
and LogTemplateOptions. At the same time:

  - it uses the same LogTemplateOptions for generating filenames and
    content (one with LTZ_LOCAL the other with LTZ_SEND), it shouldn't
    really matter, previously ts-format() and frac-digits() would not
    have propagated into filename formatting, however those are hardly
    being used in filenames and the other destinations similarly use
    the same set of settings in similar situations (sql table
    names for instance)
  - local-time-zone() setting should work again (was completely broken)

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsql: move AFSqlDestDriver declaration into the header

As the grammar will need it.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsql: use common code to parse template specific options

This patch converts affile to use the template_option rule in cfg-grammar
and LogTemplateOptions.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
value-pairs: allow setting LogTemplateOptions used for value formatting

This patch introduces value_pairs_set_template_options() which is
a borrowed LogTemplateOptions structure that is going to be used for
formatting value-pairs values. value-pairs defaults to use the global
settings but drivers can override this if they have their
per-destination settings.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
value-pairs: introduce value_pairs_new_default() function

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afamqp: add GlobalConfig as constructor parameter

Instead of relying on the "configuration" global variable, expect this
as a parameter in order to decouple from the config grammar layer.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afmongodb: add GlobalConfig as constructor parameter

Instead of relying on the "configuration" global variable, expect this
as a parameter in order to decouple from the config grammar layer.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afmongodb: use value_pairs_new_default() instead of a driver specific default

A number of drivers use the same set of defaults in value-pairs, use a
common implementation instead of open coding them in all.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afmongodb: create per-driver LogTemplateOptions

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afmongodb: Add support for acting on type hints

Since we have type hints, we should use them. This patch adds support
for all the type hints known so far (except for default, which is
special), along with support for the on-error() setting.

This fixes one part of #6.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
afstomp: add GlobalConfig as constructor parameter

Instead of relying on the "configuration" global variable, expect this
as a parameter in order to decouple from the config grammar layer.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>