cfg-grammar: Introduce template_content

The template_content type returns a LogTemplate instance, to be used by
everything that needs a template, as a single entry point.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Change value_pairs_add_pair() to take a LogTemplate

Instead of taking a string and compiling the template ourselves, take a
LogTemplate instance instead.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
cfg-grammar.y: Put a few more things into cfg-grammar.h

Export last_template, last_value_pairs and last_vp_transset to the
cfg-grammar.h header, because these are used by exported rules.
Consequently, remove the redeclaration of these from modules that had it
before.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Type hinting support

This implements very basic support for type hinting template strings,
where those hints will be available to value-pairs too, allowing any
user of either LogTemplate or value-pairs to handle different types of
values than plain strings. How they handle it, is up to the callers,
this patch just lays the groundwork that makes it possible to pass these
hints around.

Furthermore, this includes support for the on-error() statement, which
tells drivers how type-casting failures shall be handled: they can
either drop the message, drop the property, or fall back to string; and
can do either of these either verbosely, logging the fact, or silently.

This fixes #4 and #5.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@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: Balazs Scheidler <bazsi@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
format-json: Support acting on type hints

With this patch, $(format-json) becomes able to act on type hints, and
store ints as ints and so on and so forth. Forthermore, the on-error()
setting is implemented for format-json aswell.

Together with the afmongodb patch, this fixes #6.

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