[syslog-ng] log_msg_size() not used for syslog-ng internal messages

Balazs Scheidler bazsi at balabit.hu
Mon Feb 12 10:02:58 CET 2007


On Sun, 2007-02-11 at 22:25 +0100, Wolfram Schlich wrote:
> * Wolfram Schlich <lists at wolfram.schlich.org> [2007-02-08 13:06]:
> > Hi,
> > 
> > it seems that syslog-ng does not use log_msg_size() for its own
> > generated messages, because "Log statistics" messages are cut at
> > exactly 1024 characters, even if 'log_msg_size(32768)' is set
> > in syslog-ng.conf.
> > The used syslog-ng version is 2.0.2.
> 
> Balazs, can you confirm my observation?

yes, this is the case. internal messages use a fixed size buffer. I
haven't fixed this as I don't like the current STATS (aka Log
statistics) message format at all, and I was pondering on changing that.

So I can fix it easily to use a larger buffer, but beware, this
interface will most probably change in the future.

Can you check if this patch fixes your problem?

I checked that it compiles, stats messages are reported correctly, and
it does not leak. (I also commited it, so it should be available in
tomorrow's snapshot)

--- orig/src/messages.c
+++ mod/src/messages.c
@@ -43,7 +43,7 @@ GQueue *internal_msg_queue = NULL;
 static void
 msg_send_internal_message(int prio, const char *msg)
 {
-  gchar buf[1025];
+  gchar *buf;
   
   if (log_stderr || !syslog_started)
     {
@@ -55,9 +55,10 @@ msg_send_internal_message(int prio, cons
       
       if (G_LIKELY(internal_msg_queue))
         {
-          g_snprintf(buf, sizeof(buf), "<%d> syslog-ng[%d]: %s\n", prio, getpid(), msg);
+          buf = g_strdup_printf("<%d> syslog-ng[%d]: %s\n", prio, getpid(), msg);
           m = log_msg_new(buf, strlen(buf), NULL, LP_INTERNAL | LP_LOCAL, NULL);
           g_queue_push_tail(internal_msg_queue, m);
+          g_free(buf);
         }
     }
 }




-- 
Bazsi



More information about the syslog-ng mailing list