[syslog-ng] afsql dbi initialization errors checks

Balazs Scheidler bazsi at balabit.hu
Tue Mar 1 22:38:54 CET 2011


Hi Hendrik,

Sorry for not answering any sooner, but your report is really
appreciated.

I've also committed a patch that improves error handling of
dbi_initialize(), and also fixes the error suspend code. Earlier the SQL
destination was not suspended for time_reopen() seconds, but rather
milliseconds, which is less than ideal.

Here's the patch that fixes the problems for me in 3.3:

commit 02a6381005e2459d46faa6034bef8b5e0c871cb9
Author: Balazs Scheidler <bazsi at balabit.hu>
Date:   Tue Mar 1 22:30:01 2011 +0100

    afsql: added proper handling for DBI initialization errors
    
    This patch checks if dbi_initialize() returns -1 or 0, which are both
    problems that is best to be reported as early as possible.
    
    This patch also fixes SQL suspend code, earlier it suspended the driver
    not time_reopen() seconds but milliseconds.
    
    Hendrik Visage <hvjunk at gmail.com>
    Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>

Regarding the libdbi issues, I'm not sure if you nailed them all, but
it'd be nice if you could give a summary on how you succeeded.

Thanks.

On Mon, 2011-02-14 at 12:47 +0200, Hendrik Visage wrote:
> 
> 
> Hi there,
> 
>  Busy compiling (more like porting) syslog-ng 3.2 to HP-UX 11.31, and
> I've been hitting a few snags that I since over come, but now I hit
> one where I see the source code is not checking whether the afsql got
> a proper DBI initialization, nor whether the actual driver is
> available before starting the db thread/etc.
> 
> I've modified the lines 988-990 below, where they were just a simple
> "dbi_initialize();". On my setup, it "initialized", but with 0 drivers
> available :( (No, I DO have installed the Postgrsql dbi-driver, so yes
> I'll be debugging the DBI side now :()
> 
>    986    if (!dbi_initialized)
>    987      {
>    988+        msg_error("HVT: dbi_initialization",
>    989=
> evt_tag_int("status",dbi_initialize("/opt/hvsyslog-ng3/lib/dbd")
> ),
>    990+          NULL);
>    991        dbi_initialized = TRUE;
>    992      }
> 
> I also would like syslog-ng to a check at startup time and to  rather
> exit with an error if the requested DBI driver is not available, than
> to wait till the messages starts to stream in and then to throw
> screens full of errors :(
> 
> 
> Hendrik
> 
> 
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.campin.net/syslog-ng/faq.html
> 

-- 
Bazsi



More information about the syslog-ng mailing list