FreeBSD Bugzilla – Attachment 181029 Details for
Bug 115486
[patch] [request] newsyslog(8) -- provide ability to compress Nth rotated file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Provide ability to compress Nth rotated file, FBSD11
newsyslog.diff (text/plain), 2.71 KB, created by
Ben RUBSON
on 2017-03-21 15:55:41 UTC
(
hide
)
Description:
Provide ability to compress Nth rotated file, FBSD11
Filename:
MIME Type:
Creator:
Ben RUBSON
Created:
2017-03-21 15:55:41 UTC
Size:
2.71 KB
patch
obsolete
>--- newsyslog.c.orig 2016-08-12 02:08:41.000000000 +0200 >+++ newsyslog.c 2017-03-21 16:33:33.519473000 +0100 >@@ -168,6 +168,8 @@ > struct ptime_data *trim_at; /* Specific time to do trimming */ > unsigned int permissions; /* File permissions on the log */ > int flags; /* CE_BINARY */ >+ int nuncompact; /* number of rotations that should not >+ * be compressed; -1 turns this off */ > int compress; /* Compression */ > int sig; /* Signal to send */ > int def_cfg; /* Using the <default> rule for this file */ >@@ -408,6 +410,7 @@ > tempwork->trim_at = ptime_init(src_entry->trim_at); > tempwork->permissions = src_entry->permissions; > tempwork->flags = src_entry->flags; >+ tempwork->nuncompact = -1; > tempwork->compress = src_entry->compress; > tempwork->sig = src_entry->sig; > tempwork->def_cfg = src_entry->def_cfg; >@@ -426,6 +429,7 @@ > tempwork->trim_at = NULL; > tempwork->permissions = 0; > tempwork->flags = 0; >+ tempwork->nuncompact = -1; > tempwork->compress = COMPRESS_NONE; > tempwork->sig = SIGHUP; > tempwork->def_cfg = 0; >@@ -1268,6 +1272,11 @@ > } > > for (; q && *q && !isspacech(*q); q++) { >+ if (isdigit(*q)) { >+ working->nuncompact = strtol(q, NULL, 10); >+ while(isdigit(*(q+1))) q++; >+ continue; >+ } > switch (tolowerch(*q)) { > case 'b': > working->flags |= CE_BINARY; >@@ -1813,6 +1822,12 @@ > (void)rename(zfile1, zfile2); > } > change_attrs(zfile2, ent); >+ if (ent->compress > COMPRESS_NONE && >+ ent->nuncompact != -1 && >+ numlogs_c == ent->nuncompact) { >+ free_or_keep = KEEP_ENT; >+ save_zipwork(ent, NULL, ent->fsize, file2); >+ } > } > > if (ent->numlogs > 0) { >@@ -1860,7 +1875,8 @@ > swork = NULL; > if (ent->pid_cmd_file != NULL) > swork = save_sigwork(ent); >- if (ent->numlogs > 0 && ent->compress > COMPRESS_NONE) { >+ if (ent->numlogs > 0 && ent->compress > COMPRESS_NONE && >+ ent->nuncompact == -1) { > /* > * The zipwork_entry will include a pointer to this > * conf_entry, so the conf_entry should not be freed. >--- newsyslog.conf.5.orig 2016-08-12 02:08:41.000000000 +0200 >+++ newsyslog.conf.5 2017-03-21 16:51:23.546262000 +0100 >@@ -252,6 +252,16 @@ > files matched by this line. > The following are valid flags: > .Bl -tag -width indent >+.It Ar number >+In combination with one of the compression flags >+.Cm J >+or >+.Cm Z >+, this selects which one of the already-rotated archives will be >+subject to the requested compression. If it is omitted and compression >+is specified, the most recently-rotated archive file will be compressed. >+Compression is done subsequent to rotation, but the selection >+specified here is done prior to the rotation. > .It Cm B > indicates that the log file is a binary file, or has some > special format.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 115486
:
80539
| 181029