From owner-freebsd-bugs@FreeBSD.ORG Sat Sep 3 17:50:09 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E93F106566B for ; Sat, 3 Sep 2011 17:50:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 336818FC15 for ; Sat, 3 Sep 2011 17:50:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p83Ho94A003776 for ; Sat, 3 Sep 2011 17:50:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p83Ho984003775; Sat, 3 Sep 2011 17:50:09 GMT (envelope-from gnats) Resent-Date: Sat, 3 Sep 2011 17:50:09 GMT Resent-Message-Id: <201109031750.p83Ho984003775@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ian Lepore Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 367BC106566B for ; Sat, 3 Sep 2011 17:40:34 +0000 (UTC) (envelope-from ilepore@damnhippie.dyndns.org) Received: from qmta12.emeryville.ca.mail.comcast.net (qmta12.emeryville.ca.mail.comcast.net [76.96.27.227]) by mx1.freebsd.org (Postfix) with ESMTP id 1BA6F8FC0C for ; Sat, 3 Sep 2011 17:40:33 +0000 (UTC) Received: from omta16.emeryville.ca.mail.comcast.net ([76.96.30.72]) by qmta12.emeryville.ca.mail.comcast.net with comcast id UHe91h0041ZMdJ4ACHgUVa; Sat, 03 Sep 2011 17:40:28 +0000 Received: from damnhippie.dyndns.org ([24.8.232.202]) by omta16.emeryville.ca.mail.comcast.net with comcast id UHg61h00L4NgCEG8cHg6rp; Sat, 03 Sep 2011 17:40:07 +0000 Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id p83HeVOl034008 for ; Sat, 3 Sep 2011 11:40:31 -0600 (MDT) (envelope-from ilepore@damnhippie.dyndns.org) Received: (from ilepore@localhost) by revolution.hippie.lan (8.14.4/8.14.4/Submit) id p83HeVWS098843; Sat, 3 Sep 2011 11:40:31 -0600 (MDT) (envelope-from ilepore) Message-Id: <201109031740.p83HeVWS098843@revolution.hippie.lan> Date: Sat, 3 Sep 2011 11:40:31 -0600 (MDT) From: Ian Lepore To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/160432: [patch] Allow both size and at-time specifications for log rotation. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ian Lepore List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2011 17:50:09 -0000 >Number: 160432 >Category: kern >Synopsis: [patch] Allow both size and at-time specifications for log rotation. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Sep 03 17:50:08 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Ian Lepore >Release: FreeBSD 8.2-RC3 arm >Organization: none >Environment: FreeBSD dvb 8.2-RC3 FreeBSD 8.2-RC3 #49: Tue Feb 15 22:52:14 UTC 2011 root@revolution.hippie.lan:/usr/obj/arm/usr/src/sys/DVB arm >Description: If both size-based and time-based rotation parameters are specified for the same log file in newsyslog.conf, the size specification is effectively ignored because the rotation-decision logic returns early if the at-time test isn't satisfied. >How-To-Repeat: Specify both a size limit and a time specification for the same file. The log will not be rotated until the designated time regardless of how large it becomes before then. >Fix: This patch allows both size and time to be specified in a useful way. The log file will be rotated when either the size is exceeded or the designated time arrives. --- diff.tmp begins here --- --- newsyslog.c.orig 2011-09-03 11:26:46.000000000 -0600 +++ newsyslog.c 2011-08-31 16:06:09.000000000 -0600 @@ -516,7 +516,12 @@ do_entry(struct conf_entry * ent) printf("does not exist, skipped%s.\n", temp_reason); } } else { - if (ent->flags & CE_TRIMAT && !force && !rotatereq) { + if (ent->trsize > 0 && ent->fsize >= ent->trsize) { + if (verbose) { + printf("(size overrides at-time) "); + } + /* not returning here is how size overrides at-time */ + } else if (ent->flags & CE_TRIMAT && !force && !rotatereq) { diffsecs = ptimeget_diff(timenow, ent->trim_at); if (diffsecs < 0.0) { /* trim_at is some time in the future. */ --- diff.tmp ends here --- >Release-Note: >Audit-Trail: >Unformatted: