Default SQL Server Informations / Global Constants?
Hello, 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? If not, is there a way of defining some global constants and use them later? Thanks for your time. Jean F. mousinho
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. Regards, Peter -- Höltzl Péter CISA, IT biztonsági tanácsadó holtzl.peter@balabit.hu +36 20 366 966 http://peter.blogs.balabit.hu/ BalaBit IT Security 1115 Budapest XI. Bártfai u. 54. Tel +36 1 371 0540 Fax +36 1 208 0875 Az üzenet és annak bármely csatolt anyaga bizalmas, jogi védelem alatt áll, a nyilvános közléstől védett. Az üzenetet kizárólag a címzett, illetve az általa meghatalmazottak használhatják fel. Ha Ön nem az üzenet címzettje, úgy kérjük, hogy telefonon, vagy e-mail-ben értesítse erről az üzenet küldőjét és törölje az üzenetet, valamint annak összes csatolt mellékletét a rendszeréből. Ha Ön nem az üzenet címzettje, abban az esetben tilos az üzenetet vagy annak bármely csatolt mellékletét lemásolnia, elmentenie, az üzenet tartalmát bárkivel közölnie vagy azzal visszaélnie.
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
On Tue, 2009-10-20 at 08:39 +0200, Balazs Scheidler wrote:
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.
Because, the destination-driver should keep reconnecting (or change the db) to the db every time a message arrives which is a big overhead, isn't it? Peter Höltzl -- Höltzl Péter CISA, IT biztonsági tanácsadó holtzl.peter@balabit.hu +36 20 366 9667 BalaBit IT Security 1115 Budapest XI. Bártfai u. 54. Tel +36 1 371 0540 Fax +36 1 208 0875 Az üzenet és annak bármely csatolt anyaga bizalmas, jogi védelem alatt áll, a nyilvános közléstől védett. Az üzenetet kizárólag a címzett, illetve az általa meghatalmazottak használhatják fel. Ha Ön nem az üzenet címzettje, úgy kérjük, hogy telefonon, vagy e-mail-ben értesítse erről az üzenet küldőjét és törölje az üzenetet, valamint annak összes csatolt mellékletét a rendszeréből. Ha Ön nem az üzenet címzettje, abban az esetben tilos az üzenetet vagy annak bármely csatolt mellékletét lemásolnia, elmentenie, az üzenet tartalmát bárkivel közölnie vagy azzal visszaélnie.
participants (4)
-
Balazs Scheidler
-
HÖLTZL Péter
-
Höltzl Péter
-
Jean F. Mousinho