filter: Implement an in-list() filter

The in-list filter allows us to do simple file-based black- or
whitelisting. The syntax is:

 filter f_whitelist { in-list("/path/to/file.list", value("PROGRAM")); };

Implementing a blacklist is as simple as negating the in-list() filter.

The filter works by pulling in the whole file (one entry per line) and
putting it into a tree structure, and comparing against that on eval.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
basicfuncs: Add upper-case and lower-case functions

This adds two new template functions: $(upper-case) and $(lower-case)
which will upper- or lower-case their UTF-8 arguments. Based on code
from Chris Johnson <chris.johnson3@hp.com>

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
basicfuncs: Add a new $(delimit) template function

The $(delimit DELIMITERS NEW-DELIMITER HAYSTACK) template function takes
three arguments, and replaces all the delimiters from DELIMITERS in the
HAYSTACK with the NEW-DELIMITER.

For example, $(delimit x | fooxbar) would result in "foo|bar".

Based on code and ideas from Chris Johnson <chris.johnson3@hp.com>.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
basicfuncs: Add an $(env) template function

This new template function can be used to look up environment variables
and insert them into the string.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
lib/: Install header files to their proper place

With header files in subdirs of lib/, they were getting installed to
${pkgincludedir} with the extra directory parts stripped. This patch
corrects that, so headers end up where they should.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Mk/Makefile.am: Install merge-grammar.pl as executable

Instead of installing merge-grammar.pl as data, install it as a script
so it becomes executable.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
lib/merge-grammar.pl: Work from outside of the syslog-ng tree

Try opening cfg-grammar.y in the same directory the script is in, too,
so that the script will work when installed, and not only from the
syslog-ng source tree.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Mk/lex-rules.am: Make it work when installed too

Instead of referencing $(top_srcdir)/lib, use $(syslog_ng_tools) instead
in Mk/lex-rules.am, so that this file can be reused by external projects
too.

Define $(syslog_ng_tools) to $(top_srcdir)/lib in the top-level
Makefile, so that the same file will continue working in the syslog-ng
source tree too.

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

Based on initial work by Attila Nagy <bra@fsn.hu>, this destination adds
support for sending events to any STOMP-capable message queue. Similar
to AMQP and MongoDB, the driver uses value-pairs to transfer messages
across. An optional body can still be set, however.

destination d_stomp {
 stomp(
  host("localhost")
  port(61613)
  destination("/topic/syslog")
  routing-key("")      # optional, empty by default
  body("")             # optional, empty by default
  persistent(yes)
  ack(no)
  username("user")     # optional, empty by default
  password("password") # optional, empty by default
  value-pairs(scope(selected-macros, nv-pairs, sdata))
 );
};

The driver requires no new dependencies, an internal STOMP client
implementation is used.

Signed-off-by: Attila Nagy <bra@fsn.hu>
Signed-off-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
templates: Properly clear options defaults

In log_template_options_defaults(), clear all of the LogTemplateOptions
structure, not just the first few bytes.

Reported-by: Michal Privoznik <miso.privoznik@gmail.com>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
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>