LogParser: pass length argument to log_parser_process()

Since a number of parsers require an explicit length (json-parser,
and the future syslog-parser), it's useful to pass this information along,
especially as we have it in log_parser_queue(). This can potentially
save an strlen() on a potentially large chunk of data in the fastpath.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg-grammar: reorganize rules so that msg_format related rules can be reused from plugins

This patch introduces msg_format_option rule that can be referenced from
plugin grammars to parse format specific options. This is going
to be needed by the syslog-parser() plugin.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg-grammar: move common parser rules from csvparser plugin

Earlier the only plugin that used these were the csvparser plugin, but
now they make sense for syslog-parser() too

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
LogReader: separate msg-format related flags to a separate function

Earlier msg_format related flags were parsed by log_reader_options_process_flag().
Separate that to another function, so that it can be used independently
from LogReader.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-parser: introduce the new syslog-parser() parser

This patch creates a new parser, to explicitly parse messages as syslog
messages. This can be used to selectively parse these messages based on
some filters.

Imagine this use-case:

log {
        source {
                udp(port(2000) flags(no-parse));
        };
        parser {
                log {
                        junction {
                                log {
                                        filter { netmask("127.0.0.1/32"); };
                                        parser { syslog-parser(); };
                                        flags(final);
                                };
                                log {
                                        filter { netmask("127.0.0.2/32"); };
                                        parser { csv-parser(columns("C1", "C2", "C3")); };
                                        flags(final);
                                };
                        };
                };

        };
        destination {
                file("/home/bazsi/logs/qqq" template("$(format-json --key *)\n"));
        };
};

Messages from 127.0.0.1 will get parsed as syslog messages, while 127.0.0.2
as a csv-parser() style messages.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Merge remote-tracking branch '3.3/master'

Conflicts:
	.travis.yml
	NEWS
	VERSION
	lib/parser-expr-parser.c
	lib/rewrite-expr-parser.c
	modules/afsocket/afinet-source.h
tfgeoip: $(geoip) template function

This implements a $(geoip) template function using libgeoip, based on
a patch from Csaba Major. The function can be used to look up the
2-letter country code of any IPv4 address or host passed to the function.

Currently only the 2-letter codes are supported, and only from the
default database, and only for IPv4 addresses (or hosts). Adding
further functionality can be done on demand, however.

Signed-off-by: Csaba Major <csaba.major@balabit.com>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>