[syslog-ng] duplicate config elements in sql destinations

Balazs Scheidler bazsi at balabit.hu
Sun Feb 20 18:54:37 CET 2011


On Fri, 2011-02-11 at 15:04 -0600, John Kristoff wrote:
> I have a syslog-ng.conf that contains multiple destination sections
> that all begin like this:
> 
>   destination d_sql_[foo] {
>       sql(
>           type(pgsql)
>           host("127.0.0.1")
>           database("bar")
>           ...
> 
> "[foo]" differs between each section as well as the table name, columns
> and values.  However, syslog-ng complains with the following:
> 
>   Internal error, duplicate configuration elements refer to the same persistent config; name='afsql_dd(pgsql,127.0.0.1,,bar)'
> 
> Things appear to work, but apparently syslog-ng is confused by the
> duplicate database destination, even if the tables are different.  Is
> this merely cosmetic or does this have wider implications?  Perhaps
> they each end up sharing the same fifo buffer when they shouldn't for
> instance?

Well, it may cause problems. After a SIGHUP they'll possibly exchange
their queues, and they will share statistical counters.

The solution is probably to add the table template to the identifier.

Can you try this patch? (against 3.3, but should be applicable to 3.2,
or with filename changes to 3.1 as well).

diff --git a/modules/afsql/afsql.c b/modules/afsql/afsql.c
index 4d6c5d8..bbb128e 100644
--- a/modules/afsql/afsql.c
+++ b/modules/afsql/afsql.c
@@ -861,11 +861,11 @@ afsql_dd_stop_thread(AFSqlDestDriver *self)
 static gchar *
 afsql_dd_format_stats_instance(AFSqlDestDriver *self)
 {
-  static gchar persist_name[64];
+  static gchar persist_name[256];
 
   g_snprintf(persist_name, sizeof(persist_name),
-             "%s,%s,%s,%s",
-             self->type, self->host, self->port, self->database);
+             "%s,%s,%s,%s,%s",
+             self->type, self->host, self->port, self->database, self->table->template);
   return persist_name;
 }
 
@@ -875,8 +875,8 @@ afsql_dd_format_persist_name(AFSqlDestDriver *self)
   static gchar persist_name[256];
 
   g_snprintf(persist_name, sizeof(persist_name),
-             "afsql_dd(%s,%s,%s,%s)",
-             self->type, self->host, self->port, self->database);
+             "afsql_dd(%s,%s,%s,%s,%s)",
+             self->type, self->host, self->port, self->database, self->table->template);
   return persist_name;
 }
 


-- 
Bazsi




More information about the syslog-ng mailing list