[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [patch] syslogd: expand duplicate message supression
From:       "Chris Craig" <chris () microtronix ! com>
Date:       2009-04-30 16:08:24
Message-ID: 20090430120824.84e3a7d6 () mercedes ! microtronix ! com
[Download RAW message or body]

Denys Vlasenko wrote:
> > Well the existing code does this because the granularity of ctime is 1 
> > second.
> 
> Yes. But isn't this rate limiting good enough already?

Well not really, which is why I tried coming up with a patch. One of our developers \
likes to log "can't connect, trying again in 5 seconds" type messages every 5 seconds \
or so and it's annoying having them fill up the log.

> is not correct. Look how these messages are formatted:
> 
> read(3, "<13>Apr 22 03:56:21 root: msg\0", 255) = 30
> read(3, "<8>Apr 22 03:56:44 root: msg\0", 255) = 29
> 
> Second line is the result of "logger -p 0 msg".
> It will not be detected by your code.

Yes, I'm trying to get most cases, not necessarily all. From what I've seen every \
duplicate log message suppression implementation doesn't detect all duplicates.

> I don't feel that the feature you are trying to add
> is that useful, and seeing the patch which has duplicate,
> and buggy, code to detect timestamps, does not inspire.
> 
> But if you feel strong about it... maybe move the check
> to timestamp_and_log(), where timestamp detection
> is already done? Here:
> 
> if (len < 16 || msg[3] != ' ' || msg[6] != ' '
> > > msg[9] != ':' || msg[12] != ':' || msg[15] != ' '
> ) {
> time(&now);
> timestamp = ctime(&now) + 4; /* skip day of week */
> } else {
> now = 0;
> timestamp = msg;
> msg += 16;
> }
> timestamp[15] = '\0';
> 
> At this moment, msg points to the meesage *with timestamp deleted*.
> You can add dup elimination right here, and remove it elsewhere.

I tried to keep the duplicate detection in the same place as it was.

Anyway it doesn't really matter, it's not worth spending more effort on it.

-- 
Chris
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic