LogProtoIndentedMultilineServer: introduce new indented-multiline protocol

This new protocol implementation allows the use of multiline messages,
by treating indented lines as continuations of the last line. This format
is being introduced in /dev/kmsg.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Makefile.am: compile libtest first so that tests under lib work

The tests for logproto moved to lib/logproto/tests, which require the
test support code, so compile that first.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
affile: remove the use of flags for storing values of various options

The AFFILE_XXXX flags make the code more difficult to read and easier
to make mistakes. This patch gets rid of them.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
afsocket: Require libsystemd-daemon for socket activation

Instead of carrying a convenience copy of sd-daemon.c and sd-daemon.h,
require libsystemd-daemon for socket activation. If the library is not
found, systemd support will be disabled.

This is so other parts of syslog-ng can easily use systemd things
aswell, without having to move sd-daemon.* to lib/ or some similar
place.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
system-source: Use libsystemd-daemon functions

Instead of reimplementing various checks, use the functionality
provided by libsystemd-daemon to do the same things better.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
mainloop: Add support for systemd notifications

When compiling with systemd support, notify systemd about our status
and readiness via sd_notify().

Also set the service type to Type=notify in the systemd unit file.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
scl: Two reusable blocks to mask or hash credit card numbers

Contributed by Marton Illes <marci@balabit.com>, the two rewrite
blocks -credit-card-mask and credit-card-hash - can be used to mask or
hash credit card numbers that may appear in log messages.

For more information about the topic, see his blog post at:
 http://marci.blogs.balabit.com/2013/02/masking-credit-card-numbers-in-log-messages-with-syslog-ng/

The block names were changed to be less cryptic, and the regexp was
lifted out into a shared define.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
value-pairs: Rename replace() to replace-prefix()

This renames the replace() value-pairs rekey option to
replace-prefix(), because that is what it does. This is done for both
the value-pairs() grammar, and for the command-line-like parser used
for template functions too.

For compatibility's sake, replace() remains as an alias for now, but
it is marked as obsolete, and will emit a warning.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
afmongodb: Remove the username() and password() options

These were never documented, and they never worked either, and there
appears no demand for it, either. Best remove them, until such time
that they can be implemented sanely.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
versioning: Change the current version to 3.5

This adds the VERSION_3_5 macro, and updates VERSION_VALUE and
VERSION_CURRENT_* to 3.5 aswell.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
configure.ac: There is no lib/libproto/Makefile

The Makefile.am (libproto.am) snippet from lib/libproto is directly
included into lib/Makefile.am, there is no
lib/libproto/Makefile.am. The configure.ac script should reflect this
too.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
tests/functional: Bump config versions to 3.5

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
travis: Don't install syslog-ng before make check

make check should work even when syslog-ng is uninstalled, so lets
test this property too, by not installing it.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Add an "indented-multiline" logreader flag

Teach logreader to accept "indented-multiline" as a flag, so that
affile and afsocket can look for it, and set the proto to
indented-multiline instead of text if the flag's found.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
linux-kmsg-format: New format plugin to parse /dev/kmsg messages

With linux 3.5, /dev/kmsg was changed substantially, and it now emits
structured kernel messages towards userspace. For its format, see
Documentation/ABI/testing/dev-kmsg in a recent kernel source.

This format plugin implements the parser for that format, including
special parsing for the DEVICE keys, and resolving of the message
timestamps on Linux (the monotonic timestamp is stored too
nevertheless).

To use it on a 3.5+ kernel, something along these lines should replace
the /proc/kmsg source:

  file("/dev/kmsg"
       flags(kernel)
       program-override("kernel")
       format("linux-kmsg"));

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
affile: Treat /dev/kmsg on linux specially

On Linux, use a dgram reader for /dev/kmsg, because it works almost
exactly like a dgram source anyway, and a dgram reader is more
efficient than the indented-multiline one.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
system-source: Add Linux 3.5+ /dev/kmsg support

When on Linux, and /dev/kmsg is seekable, use that over /proc/kmsg,
using indented-multiline and the linux-kmsg format.

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