logthrdestdrv: New low-level destination driver class

The LogThrDestDriver class implements the bulk of the code needed to
create a threaded destination driver.

What a derived driver needs to implement, are the following:

 * Thread init / deinit functions (LogThrDestDriver->worker.init and
   ->worker.deinit): both of which receive the object itself. These
   functions - if not NULL - can be used to do custom, driver-specific
   initialisation/deinitalisation within the worker thread.

 * Disconnecting the worker thread (LogThrDestDriver->worker.disconnect).

 * Inserting into the destination (LogThrDestDriver->worker.insert).

 * Custom queue-time commands (->queue_method), which is called whenever
   pushing an item towards the worker queue.

One also needs to implement the LogDestDriver class' init, deinit and
free methods. Functions are provided to help init, deinit and free the
LogThrDestDriver instance: _init_method(), _deinit_method() and _free().

Two other functions are available:
log_threaded_dest_driver_init_instance(), which should be called from
the derived driver's _new() function, and _start(), which should be
called from the same function, at the end.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
mongodb: Convert to LogThrDestDriver

This converts the MongoDB destination to use the newly introduced
LogThrDestDriver class.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
amqp: Convert to LogThrDestDriver

This converts the AMQP destination to use the newly introduced
LogThrDestDriver class.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
smtp: Convert to LogThrDestDriver

This converts the SMTP destination to use the newly introduced
LogThrDestDriver class.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
stomp: Made stomp driver inherit from LogThreadedDestDriver
stomp: Removed routing key from stomp driver.

Because routing_key is an amqp idiom, in stomp this is called
destination. It is used only in stomp, when one wants to interop
with amqp, but in this case, it is rarely used on the publisher side.
If somebody wants to use it, it can be achieved by using a rewrite rule,
setting routing_key there, and using value-pairs in the stomp driver.
stomp: Fixed several memory leaks.

Scratch buffer wasn't released, when driver was not connected,
and we leaked strings during header parsing.
stomp: Fix a few compile-time warnings

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
redis: New destination driver

Based on the work of Tihamer Petrovics during the Google Summer of Code
2013, this driver implements a new destination driver that allows
syslog-ng to send events to a Redis key-value sture.

destination d_redis {
 redis(
  host("localhost")
  port(6369)

  command("HINCRBY", "hosts", "$HOST", "1")
 );
};

The driver requires the hiredis library, and will try to detect it
during configure-time.

Signed-off-by: Tihamer Petrovics <tihameri@gmail.com>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
.travis.yml: Install libhiredis-dev too.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
templates: don't use the global configuration variable in log_template_new

That shouldn't be used outside of the configuration load/reload mechanism,
and we get it as a parameter anyway.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
loggen: fix no-framing option

Signed-of-by: Tibor Benke <btibi@balabit.hu>
filter-in-list: Ignore empty lines in the input file

Ignore empty lines in the input file, because an empty value would match
those, and we do not want that.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
filter-in-list: Fix a compilation error on FreeBSD

Do #include <string.h> for memcmp(), strcmp() and strlen(), since we're
using those functions directly.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
templates: use the global options if NULL is passed as template_options

Use the global template-options structure in GlobalConfig instead of a
hard-wired set of defaults when the template_options argument is NULL.

This is a minor change in user visible behaviour, as the global
ts-format(), frac-digits() and time-zone related options will
become effective to the call-sites which didn't provide their own
idea about template options before.

Previously, a hard-wired set of defaults were used, e.g.:
  - frac-digits(0)
  - ts-format(bsd)
  - neither local-time-zone nor send-time-zone are set

Out of these, only frac-digits() have some chance to actually break
user-configurations as the call-sites that used the hard-wired values
are not really likely to use time related macros.

The confusion of not applying the global options is potentially larger,
not to mention the code complexities this causes in all drivers using
templates.

These are the call-sites that used the hard-wired values before:
  - filter expressions that use the comparison operators
  - regexp based substitutions
  - incoming templates for parsers
  - the new value rewrite rules
  - smtp values
  - the just introduced drivers (stomp, amqp)
  - patterndb context-id

The consequence of this patch that we're going to have a LogTemplateOptions
available in template functions too.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
value-pairs: Require LogTemplateOptions to be passed at run-time

Instead of storing a borrowed LogTemplateOptions copy, require passing
one in at run-time (via value_pairs_foreach() or value_pairs_walk()).
This provides more flexibility, and can guarantee thread safety too.

All drivers that use value-pairs have been updated accordingly.

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.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Preparations for 3.5.0beta2

VERSION bumped, and NEWS items added.

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