modules/getent: Implement a $(getent) template function

This implements most of the $(getent) template function, with the syntax
proposed in #26. $(getent hosts) is not implemented, and the rest aren't
all that portable, but for now, this will do.

Requested-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
getent: Minor code cleanup

Moved a typedef to the top of the C file, where it belongs.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
getent: Add support for returning a selected member

When using $(getent passwd), we can now return a selected member of the
structure. Without a third argument, we continue working as we did
before, but if a third argument is present, we'll pick out the specified
field.

Requested-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
getent: Code cleanup

All the lookup functions were using key->str, so lets pass that alone,
not the whole of key.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
getent: Split into multiple files

For easier maintenance, split tfgetent.c into smaller files.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
add basic $(getent group) functionality
Add support for 'mem'
Using 'mem' for key will yield a coma separated list of group members
riemann: Fix the float-y metric casting code

When casting strings to float, correctly recognise when the casting
succeeds, and when it fails. This fixes #27.

Reported-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #29 from ccin2p3/f/getent-group

add support for $(getent group)
getent: mem => members

To get the list of group members as a comma-separated list, one should
use $(getent group $GID members) instead of the former $(getent group
$GID mem).

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
getent: Cosmetic cleanups

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
README.md: Mention $(getent) too

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
perl: New module implementing a Perl destination

This new module implements a fairly simple Perl destination, with which
one can write destination modules in Perl. The module will call three
functions: init, deinit and queue (the name of all three are
configurable, of course). The first two receive no arguments, the queue
method receives a hash map of key-value pairs, selected by
value-pairs().

It does some type hinting (int and string supported only, so far), and
does not support sub-hashes yet.

This fixes #21.

Requested-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
python: Add a python destination module

This works in a very similar way to the Perl destination, except that it
is for python, and supports an imports() argument too, which can list
modules to pre-load before the script.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
python: Make the init/deinit functions optional

When there is no init or deinit function set in the config, don't even
try to call them, or we may crash.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
perl: Better function names and small refactoring

Use a better function name instead of
_perl_call_func_noargs() (_call_perl_function_with_no_arguments), and do
use its return value from the _init() and _deinit() methods.

Reported-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
python: Better function names, and small refactoring

Use better function names (suggested by Viktor Tusa), and split the
python_worker_eval() function into smaller parts.

Reported-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
python: Fix the module when used multiple times

In case we're using the python destination multiple times within a
syslog-ng config, it needs to be aware of threads and the GIL. This
patch teaches the destination to hold the GIL at appropriate times.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Merge pull request #32 from algernon/f/mod-languages

Scripting language plugins for the Incubator
python: Add support for python3+

Added a --with-python=VERSION option to configure.ac, and changed the
python destination to work with both python2 and python3. Tested with
python 2.7 and 3.3.

The configure check defaults to searching for the unversioned "python"
package.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>