[syslog-ng] [PATCH (3.4)] afsql: Add support for specifying custom SQL backend options.

Balazs Scheidler bazsi at balabit.hu
Wed Dec 21 13:50:46 CET 2011


On Wed, 2011-12-07 at 12:11 +0100, Gergely Nagy wrote:
> When one is using an SQL backend that supports a set of options that
> syslog-ng does not set itself, yet, one does want these options set,
> there was previously no way to accomplish that without changing the
> source.
> 
> This patch adds a new option: dbd-option(OPTION_NAME VALUE) (where
> OPTION_NAME is always a string, and value can be either a string, or a
> number). The options specified this way will always be set with libdbi
> whenever we (re)connect to the database.
> 
> A simple use-case:
> 
> destination d_slow_sql_test {
>   sql(type("null")
>       dbd-option("null.sleep.connect" 1)
>       dbd-option("null.sleep.query" 5)
>       columns("dummy")
>       values("1")
>   );
> };
> 
> Signed-off-by: Gergely Nagy <algernon at balabit.hu>
> ---
>  modules/afsql/afsql-grammar.ym |    3 +++
>  modules/afsql/afsql-parser.c   |    2 ++
>  modules/afsql/afsql.c          |   40 ++++++++++++++++++++++++++++++++++++++++
>  modules/afsql/afsql.h          |    4 ++++
>  4 files changed, 49 insertions(+), 0 deletions(-)

I would apply this, however the set of dbd-options really depends on the
libdbi driver in question. And if once-upon-a-time I'd leave libdbi
behind and use something else, these would not work.

So I would put a big-fat warning that the meaning of these options can
be changed at any time.

-- 
Bazsi




More information about the syslog-ng mailing list