NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/46608: Add xz compression support to newsyslog



>Number:         46608
>Category:       bin
>Synopsis:       Add a third compression option to newsyslog
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 17 01:45:00 +0000 2012
>Originator:     Jim Bernard
>Release:        NetBSD 6.99.7
>Organization:
>Environment:
System: NetBSD 6.99.7 #0: Wed Jun 13 19:59:26 MDT 2012 i386
Architecture: i386
Machine: i386
>Description:
        newsyslog currently supports two types of compression, gzip with
        the configuration-file "Z" flag and bzip2 with the "J" flag.  The
        person who added bzip2 compression really planned ahead, making
        it trivial to add new compression types.  The attached patch set
        adds compression with xz, using configuration-file flag "X".

>How-To-Repeat:
        Read the man page or the code.

>Fix:
        I elected to use the default compression level, because the
        compression time and memory usage vary so widely with the
        compression preset levels in xz.

--- newsyslog.c-dist    2009-08-21 02:20:19.000000000 -0600
+++ newsyslog.c 2012-06-16 19:01:35.000000000 -0600
@@ -119,10 +119,11 @@
 static struct compressor compress[] =
 {
        {NULL, "", "", ""}, /* 0th compressor is "no compression" */
        {"/usr/bin/gzip", "-f", ".gz", "Z"},
        {"/usr/bin/bzip2", "-9f", ".bz2", "J"},
+       {"/usr/bin/xz", "-f", ".xz", "X"},
 };
 
 #define _PATH_NEWSYSLOGCONF    "/etc/newsyslog.conf"
 #define _PATH_SYSLOGDPID       _PATH_VARRUN"syslogd.pid"
 
@@ -375,11 +376,11 @@
                        log->flags |= CE_NOSIGNAL;
                        break;
                case 'P':
                        log->flags |= CE_PLAIN0;
                        break;
-               case 'J': case 'Z':
+               case 'J': case 'X': case 'Z':
                        for (ziptype = __arraycount(compress); --ziptype; ) {
                                if (*compress[ziptype].flag == qq)
                                    break;
                        }
                        break;
--- newsyslog.8-dist    2007-12-21 12:45:33.000000000 -0700
+++ newsyslog.8 2012-06-16 19:13:38.000000000 -0600
@@ -38,11 +38,11 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
 .\" from FreeBSD: newsyslog.8,v 1.14.2.1 1999/02/25 18:38:33 wollman Exp
 .\"
-.Dd December 21, 2007
+.Dd June 16, 2012
 .Dt NEWSYSLOG 8
 .Os
 .Sh NAME
 .Nm newsyslog
 .Nd maintain system log files to manageable sizes
@@ -332,10 +332,14 @@
 should not be compressed.
 .It Sy j
 Archived log files should be compressed with
 .Xr bzip2 1
 to save space.
+.It Sy x
+Archived log files should be compressed with
+.Xr xz 1
+to save space.
 .It Sy z
 Archived log files should be compressed with
 .Xr gzip 1
 to save space.
 .El



Home | Main Index | Thread Index | Old Index