Date: Wed, 25 Apr 2012 07:04:48 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r234674 - stable/9/usr.sbin/newsyslog Message-ID: <201204250704.q3P74mQO084849@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Wed Apr 25 07:04:48 2012 New Revision: 234674 URL: http://svn.freebsd.org/changeset/base/234674 Log: Merge r233257, r233258 from head: Don't run through time checks when entry is definitely oversized. This leads to newsyslog rotating on (size OR time) if both are specified. Fix a sentence in a paragraph that describes time and interval based trimming. This sentence vaguely can be interpreted as if it was speaking about time and size interaction, while it wasn't about it. PR: 100018, 160432 Modified: stable/9/usr.sbin/newsyslog/newsyslog.c stable/9/usr.sbin/newsyslog/newsyslog.conf.5 Directory Properties: stable/9/usr.sbin/newsyslog/ (props changed) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/9/usr.sbin/newsyslog/newsyslog.c Wed Apr 25 06:52:26 2012 (r234673) +++ stable/9/usr.sbin/newsyslog/newsyslog.c Wed Apr 25 07:04:48 2012 (r234674) @@ -484,12 +484,14 @@ do_entry(struct conf_entry * ent) fk_entry free_or_keep; double diffsecs; char temp_reason[REASON_MAX]; + int oversized; free_or_keep = FREE_ENT; if (verbose) printf("%s <%d%s>: ", ent->log, ent->numlogs, compress_type[ent->compress].flag); ent->fsize = sizefile(ent->log); + oversized = ((ent->trsize > 0) && (ent->fsize >= ent->trsize)); modtime = age_old_log(ent->log); ent->rotate = 0; ent->firstcreate = 0; @@ -518,7 +520,8 @@ 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->flags & CE_TRIMAT && !force && !rotatereq && + !oversized) { diffsecs = ptimeget_diff(timenow, ent->trim_at); if (diffsecs < 0.0) { /* trim_at is some time in the future. */ @@ -574,7 +577,7 @@ do_entry(struct conf_entry * ent) } else if (force) { ent->rotate = 1; snprintf(temp_reason, REASON_MAX, " due to -F request"); - } else if ((ent->trsize > 0) && (ent->fsize >= ent->trsize)) { + } else if (oversized) { ent->rotate = 1; snprintf(temp_reason, REASON_MAX, " due to size>%dK", ent->trsize); Modified: stable/9/usr.sbin/newsyslog/newsyslog.conf.5 ============================================================================== --- stable/9/usr.sbin/newsyslog/newsyslog.conf.5 Wed Apr 25 06:52:26 2012 (r234673) +++ stable/9/usr.sbin/newsyslog/newsyslog.conf.5 Wed Apr 25 07:04:48 2012 (r234674) @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd February 25, 2011 +.Dd March 21, 2012 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -130,7 +130,7 @@ Additionally, the format may also be con sign along with a rotation time specification of once a day, once a week, or once a month. .Pp -If a time is specified, the log file will only be trimmed if +Time based trimming happens only if .Xr newsyslog 8 is run within one hour of the specified time. If an interval is specified, the log file will be trimmed if that many
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204250704.q3P74mQO084849>