Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Apr 2017 20:37:35 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316981 - head/usr.sbin/newsyslog
Message-ID:  <201704152037.v3FKbZ91015048@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sat Apr 15 20:37:34 2017
New Revision: 316981
URL: https://svnweb.freebsd.org/changeset/base/316981

Log:
  Add a new Y flag to newsyslog.conf
  
  This makes newsyslog use zstandard to compress log files.
  
  Given Z is already taken for gzip and zstandard compression level stands in
  between gzip and xz (which has the X flag) chosing Y sounds ok :)

Modified:
  head/usr.sbin/newsyslog/newsyslog.8
  head/usr.sbin/newsyslog/newsyslog.c
  head/usr.sbin/newsyslog/newsyslog.conf.5
  head/usr.sbin/newsyslog/pathnames.h

Modified: head/usr.sbin/newsyslog/newsyslog.8
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.8	Sat Apr 15 20:15:44 2017	(r316980)
+++ head/usr.sbin/newsyslog/newsyslog.8	Sat Apr 15 20:37:34 2017	(r316981)
@@ -17,7 +17,7 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
-.Dd September 23, 2014
+.Dd April 15, 2017
 .Dt NEWSYSLOG 8
 .Os
 .Sh NAME
@@ -288,6 +288,7 @@ accepted for backwards compatibility.
 .Xr bzip2 1 ,
 .Xr gzip 1 ,
 .Xr xz 1 ,
+.Xr zst 1 ,
 .Xr syslog 3 ,
 .Xr newsyslog.conf 5 ,
 .Xr chown 8 ,

Modified: head/usr.sbin/newsyslog/newsyslog.c
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.c	Sat Apr 15 20:15:44 2017	(r316980)
+++ head/usr.sbin/newsyslog/newsyslog.c	Sat Apr 15 20:37:34 2017	(r316981)
@@ -100,17 +100,22 @@ __FBSDID("$FreeBSD$");
 #define	COMPRESS_SUFFIX_XZ	".xz"
 #endif
 
+#ifndef	COMPRESS_SUFFIX_ZST
+#define	COMPRESS_SUFFIX_ZST	".zst"
+#endif
+
 #define	COMPRESS_SUFFIX_MAXLEN	MAX(MAX(sizeof(COMPRESS_SUFFIX_GZ),sizeof(COMPRESS_SUFFIX_BZ2)),sizeof(COMPRESS_SUFFIX_XZ))
 
 /*
  * Compression types
  */
-#define	COMPRESS_TYPES  4	/* Number of supported compression types */
+#define	COMPRESS_TYPES  5	/* Number of supported compression types */
 
 #define	COMPRESS_NONE	0
 #define	COMPRESS_GZIP	1
 #define	COMPRESS_BZIP2	2
 #define	COMPRESS_XZ	3
+#define COMPRESS_ZSTD	4
 
 /*
  * Bit-values for the 'flags' parsed from a config-file entry.
@@ -149,7 +154,8 @@ static const struct compress_types compr
 	{ "", "", "" },					/* no compression */
 	{ "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP },	/* gzip compression */
 	{ "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2 },	/* bzip2 compression */
-	{ "X", COMPRESS_SUFFIX_XZ, _PATH_XZ }		/* xz compression */
+	{ "X", COMPRESS_SUFFIX_XZ, _PATH_XZ },		/* xz compression */
+	{ "Y", COMPRESS_SUFFIX_ZST, _PATH_ZSTD }	/* zst compression */
 };
 
 struct conf_entry {
@@ -1299,6 +1305,9 @@ no_trimat:
 			case 'x':
 				working->compress = COMPRESS_XZ;
 				break;
+			case 'y':
+				working->compress = COMPRESS_ZSTD;
+				break;
 			case 'z':
 				working->compress = COMPRESS_GZIP;
 				break;

Modified: head/usr.sbin/newsyslog/newsyslog.conf.5
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.conf.5	Sat Apr 15 20:15:44 2017	(r316980)
+++ head/usr.sbin/newsyslog/newsyslog.conf.5	Sat Apr 15 20:37:34 2017	(r316981)
@@ -21,7 +21,7 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
-.Dd October 24, 2015
+.Dd April 15, 2017
 .Dt NEWSYSLOG.CONF 5
 .Os
 .Sh NAME
@@ -303,6 +303,12 @@ indicates that
 should attempt to save disk space by compressing the rotated
 log file using
 .Xr xz 1 .
+.It Cm Y
+indicates that
+.Xr newsyslog 8
+should attempt to save disk space by compressing the rotated
+log file using
+.Xr zstd 1 .
 .It Cm N
 indicates that there is no process which needs to be signaled
 when this log file is rotated.

Modified: head/usr.sbin/newsyslog/pathnames.h
==============================================================================
--- head/usr.sbin/newsyslog/pathnames.h	Sat Apr 15 20:15:44 2017	(r316980)
+++ head/usr.sbin/newsyslog/pathnames.h	Sat Apr 15 20:37:34 2017	(r316981)
@@ -27,3 +27,4 @@ provided "as is" without express or impl
 #define	_PATH_BZIP2	"/usr/bin/bzip2"
 #define	_PATH_GZIP	"/usr/bin/gzip"
 #define	_PATH_XZ	"/usr/bin/xz"
+#define	_PATH_ZSTD	"/usr/bin/zstd"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704152037.v3FKbZ91015048>