[syslog-ng] Default SQL Server Informations / Global Constants?
Balazs Scheidler
bazsi at balabit.hu
Tue Oct 20 08:39:54 CEST 2009
On Wed, 2009-10-14 at 09:10 +0200, HÖLTZL Péter wrote:
> On Mon, 2009-10-12 at 12:40 +0100, Jean F. Mousinho wrote:
>
> > Is there a way of defining a default hostname, username, password, etc
> > for the sql destination? or I've to duplicate this information for every
> > destination defined?
>
>
> Hi!
>
> At this moment it is not possible. Do you want to connect to the same DB
> server with the same user ID and pass BUT to a different database? It is
> only a guess but I would try to use a MACRO as a DB name. I mean this:
>
> destination d_sql {
> sql(type(pgsql)
> host("logserver") username("syslog-ng") password("password")
>
> database("logs_${HOST}")
>
> table("messages_${HOST}_${R_YEAR}${R_MONTH}${R_DAY}")
> columns("datetime", "host", "program", "pid", "message")
> values("$R_DATE", "$HOST", "$PROGRAM", "$PID", "$MSGONLY")
> indexes("datetime", "host", "program", "pid", "message"));
> };
>
>
> Therefore you only need one destination instead of several.
This is not currently possible. syslog-ng doesn't handle macros in
database() names, and that wouldn't be very easy to implement right now.
--
Bazsi
More information about the syslog-ng
mailing list