[syslog-ng]incoming message stats (fwd)

Jim syslog-ng@lists.balabit.hu
Thu, 7 Apr 2005 14:49:11 -0400 (EDT)


Anyone have any thoughts on this?



---------- Forwarded message ----------
Date: Fri, 1 Apr 2005 13:45:48 -0500 (EST)
From: Jim <jim@jeke.fdns.net>
Reply-To: syslog-ng@lists.balabit.hu
To: syslog-ng@lists.balabit.hu
Subject: [syslog-ng]incoming message stats

Hello,

I would like to get some stats on the number of incoming messages I am 
receiving on a central log server.

I am running syslog-ng 1.6.6, built with libol 0.3.15.

>From what I can see, I will need to modify libol in order for syslog-ng to 
count these messages, and tell me at a regular interval. Does this sound 
right, or am I missing another simple way to do this?

assuming I have to modify source, it looks like I can just add a counter 
to the do_write_str() function in pkt_buffer.c that looks something like 
this:
    if (self->queue_size == self->queue_max) {
        /* fifo full */
        pktbuf_dropped_pkts++;
        ol_string_free(string);
        return ST_FAIL | ST_OK;
    }
    else {
        struct buffer_node *item;
-->        pktbuf_recved_pkts++;

        NEW_SPACE(item);
        item->packet = string;
        ol_queue_add_tail(&self->queue, &item->header);
        if (++self->queue_size == self->queue_max && self->super.writable)
            (*self->super.writable) = 0;
    }

the "-->" indicates the new line.

Pretty much all I did was copy where the "pktbuf_dropped_pkts" was, and 
added in my variable.

The numbers that I get when I run with this don't appear to totally match 
up with what I  expect, but is fairly close. Is this the right place to 
insert a counter to count total syslog messages recieved over the network 
(from both TCP and UDP sources).
If not, can someone point me in a different direction?

thanks!
Mike
_______________________________________________
syslog-ng maillist  -  syslog-ng@lists.balabit.hu
https://lists.balabit.hu/mailman/listinfo/syslog-ng
Frequently asked questions at http://www.campin.net/syslog-ng/faq.html