newsyslog version 1.9

(periodic log rotation and maintenance)
Written by Russ Allbery <>

Copyright 1997, 1998, 1999, 2000, 2002, 2004, 2005, 2011 The Board of Trustees of the Leland Stanford Junior University. This software is distributed under a BSD-style license. Please see the file LICENSE in the distribution for more information.


newsyslog is a log rotation system with the expected support for rotating any number of logs, running commands before or after log rotation, rotating and saving a fixed number of logs, and compressing rotated logs. It varies from other, similar systems in having special support for embedding dates in the path to which the log is written and supporting insert-only destination file systems (such as AFS with minimal ACLs).


This package is designed to perform periodic maintenance on system log files. Its primary design goals are to make the specification of what maintenance to perform as flexible as possible, to be as self-contained as possible to decrease reliance on other packages, and to be as safe and as paranoid in its operation as possible (and to be extremely verbose in its error reporting).

newsyslog handles moving or copying logs into one or more archive directories, compressing them in the process, and running arbitrary commands or sending signals to stop and restart servers so that logs can be rotated. The source and destination paths can contain the date of the log in a variety of formats and the system name. The archived logs can be rotated and the oldest deleted if desired, or a log can be archived into a specific date-stamped location. In the latter mode, newsyslog supports insert-only remote file systems (such as AFS with minimal ACLs) as a log archive destination.

For the full details of what newsyslog can do, see the included man page. All operation of newsyslog is controlled by a configuration file, by default /usr/local/etc/newsyslog.conf. See the file CONFIG for a sample configuration file; another, shorter sample with fewer comments is embedded in the man page.


This package compresses logs internally on the fly, and therefore requires and links against a compression library, either zlib or bzip2. For support for the -b option, bzip2 is required; if zlib is not installed, then the -b option must always be used.

Neither zlib nor bzip2 are included in this package; if they are not already installed on your system, you can obtain a copy of zlib at:


and a copy of bzip2 from any Linux or BSD distribution. Note that you will need to install the library and header files from bzip2, not just the programs.

To build this package, you will need to have the libraries and header files installed, which means you may have to install the -devel or -dev version of the package as well as the basic version if you are installing them from a distribution.

To run the test suite, you must either be root or have the fakeroot binary available, since the test suite tests newsyslog's setting of file ownership and permissions.

newsyslog obviously also requires a C compiler. If you plan to hack on the sources, you'll need gcc (since the dependency generation assumes it), bison, flex, pod2man to generate the man page, Autoconf 2.64 or later, and Automake 1.11 or later, depending on what you want to modify. None of those additional programs are required to build the distribution (the output of bison and flex is included in the tarball).


Basic installation is simple. Just run:

    make install

Pass --enable-silent-rules to configure for a quieter build (similar to the Linux kernel). Use make warnings instead of make to build with full GCC compiler warnings (requires a relatively current version of GCC).

This will build newsyslog and install it in /usr/local/sbin and its man pages into /usr/local/share/man. To install in a different location, specify a different location with the --prefix option to configure, as in:

    ./configure --prefix=/opt/sw

newsyslog would then be installed in /opt/sw/sbin and the man page in /opt/sw/share/man/man8. Alternately, --sbindir and --mandir can be given to change the installation locations of the binary and manual pages separately.


newsyslog does come with a test suite, mostly used for regression testing new versions during development, but also usable for sanity-checking a compile of newsyslog. Please note that it requires Perl, assumes newsyslog has been built with bzip2 functionality, and is much less portable than newsyslog itself.

To run the test suite, just run:

    fakeroot make check

after compiling newsyslog if you have fakeroot available. (It's packaged for Debian and Debian-derived distributions.) If you don't have fakeroot, you will have to run the test as root, since it tests changing file ownership (among other things).

If a test fails, you can run a single test with verbose output via:

    fakeroot tests/runtests -o <name-of-test>

or, as above, as root. Do this instead of running the test program directly since it will ensure that necessary environment variables are set up.


The newsyslog distribution page at:

will always have the current version of this package, the current documentation, and pointers to any additional resources.

newsyslog is maintained using Git. You can access the current source by cloning the repository at:


or view the repository via the web at:
Converted to XHTML by faq2html version 1.33