test_systemd_journal: do not check HOST_FROM, because it is not set by the journal_reader

Signed-off-by: Juhász Viktor <viktor.juhasz@balabit.com>
journald-mock: do not use pipe2() which is linux(glibc>=2.9)-specific

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
systemd-journal: use the sd_journal_get_realtime_usec instead of _SOURCE_REALTIME_TIMESTAMP field

Signed-off-by: Juhász Viktor <viktor.juhasz@balabit.com>
systemd-journal: Added debug message for incoming messages from journal.

Signed-off-by: Juhász Viktor <viktor.juhasz@balabit.com>
systemd-journal: only one instance is acceptable

Signed-off-by: Juhász Viktor <viktor.juhasz@balabit.com>
systemd-journal: if _COMM field does not exists, use the PROGRAM_IDENTIFIER field.

Signed-off-by: Juhász Viktor <viktor.juhasz@balabit.com>
systemd-journal: add seek_to_tail function to journald_subsystem

Signed-off-by: Juhász Viktor <viktor.juhasz@balabit.com>
logmsg: add new interface to make easier to manipulate name value pairs.

There are a lot of occurrences in syslog-ng, where we have the name and
the value, but we have to get a handle and set or get the value via the handle

These functions make possible to omit to get the handle by name.

New functions:
  * log_msg_get_value_by_name
  * log_msg_set_value_by_name
logmsg: use the log_msg_set_value_by_name and log_msg_get_value_by_name

to make the code cleaner where it is possible.

Signed-off-by: Juhász Viktor <viktor.juhasz@balabit.com>
Merge pull request #263 from juhaszviktor/f/journald-fixes

F/journald fixes
logthrdestdrv: Fixes for centralized retries() functionality

New worker insert result type added: WORKER_INSERT_RESULT_NOT_CONNECTED.

When an insert() failes due to a connection error, syslog-ng
 - should rewind the message
 - should do suspend()
 - and should not increment retries counter.

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #264 from lbudai/3.6/logthrdestdrv-retries-fixes

logthrdestdrv: Fixes for centralized retries() functionality
Merge pull request #267 from juhaszviktor/f/reach_value_by_name

F/reach value by name
rewrite: Only ref condition filter, if it is not NULL.
Merge pull request #269 from talien/f/rewrite-clone-condition-fix

rewrite: Only ref condition filter, if it is not NULL.
afsql: trying to do a better transaction handling

Two problems with transactions:
 * mixing DDL and DML statements in a single transaction
   (create/update table)
 * simple select can abort a transaction
   (checking if a table exists or not)

syslog-ng checks whether a table exists or not by 'select * from table'
(and get structure of the table as a side-effect...)

There are some DB-providers which abort current transaction when try to
select from a non-existing table (eg.:mssql).

libdbi provides a better, db-provider specific way to checking table existance
(this is a meta-query which always succeed).
Unfortunately, this function is buggy in pgsql driver, so we had to do
something else).

syslog-ng asks db only when the name of the table to be checked is not seen
before (this is based on a runtime information: every table is validated and
name of all validated tables are stored in a hashtable).

When the table not found in the list of validated tables:
 - active transaction is commited (if exists)
 - new transaction is started for checking if the table exists or not
    - if the table exists, its structure is updated according to the
      structure given in the config file
    - otherwise a new table is created

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
afsql: validate_table() refactored

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>