newsyslog

The Moving Finger writes; and, having writ,
Moves on: nor all thy Piety nor Wit
Shall lure it back to cancel half a Line,
Nor all thy Tears wash out a Word of it.

Omar Khayyam, The Rubayyat

Warning

This package is orphaned. Although I believe it is still useful, I no longer use AFS and therefore no longer need the special features of this program for handling write-only destination directories. I am therefore no longer maintaining this package. If you would like to pick up maintenance of it, please feel free. Contact me if you would like this page to redirect to its new home.

Description

This was one of the first large C programs that I wrote entirely from scratch, and one of my first projects when I came to work for Stanford. It's been reworked a few times since then, though, so it mostly doesn't show.

Before I wrote this program, we were using hacked versions of Sun's standard log rotation shell scripts to save system logs. The purpose of this program was to provide portable log rotation for all of our servers and cluster machines, for the most part writing the log files into AFS. I wrote it to be completely stand-alone and not depend on any external programs, since we wanted it to work even if AFS was down (and nearly all software for our machines is in AFS).

All log files rotated by newsyslog are compressed, with the choice of either gzip-style zlib compression or bzip2 compression. newsyslog also has the ability to run an analyze program on the log file (usually useful to scan the log for anomalous entries and report them, perhaps by sending a report in e-mail), and to run a filter program on the log before archiving it and only archiving the output from the filter (so that the uninteresting lines can be stripped out before archiving). It also has the standard features that you'd expect in a log rotation program, such as being able to save a given number of old copies of a log and running commands to stop and restart the service around the log rotation.

Since I wrote this program, various other programs that do similar things have shown up, most notably logrotate (which is widely used in Linux distributions). The main reason to use newsyslog instead of one of those programs is that it's simpler, more self-contained, recovers smoothly from failed log rotations when the destination directory is temporarily unavailable, and has support for doing a minimum of file operations to save an archived log (so that we can archive logs into AFS directories with very restrictive ACLs). It is not as flexible or as featureful as other log rotation programs, however.

For the program I use to analyze syslog logs after rotating them, see filter-syslog.

Requirements

newsyslog is written in C, so you'll need a C compiler. You'll also need a compression library, at least one of zlib or the library that comes with bzip2. For support of the -b option, bzip2 is required, and if zlib is not installed, the -b option must always be used.

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.

If you plan to hack on the sources, you'll need 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).

Download

The distribution:

newsyslog 1.9 2011-12-16 Download PGP signature

An archive of older releases is also available.

A Debian package is available from my personal repository.

newsyslog is maintained using the Git version control system. To check out the current development tree, clone:

    git://git.eyrie.org/system/newsyslog.git

You can also browse the current development source.

Documentation

User documentation:

Developer documentation:

License

The newsyslog package as a whole is released under the following license:

Copyright 1997, 1998, 1999, 2000, 2002, 2004, 2005, 2011 The Board of Trustees of the Leland Stanford Junior University.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Some individual source files are covered by other, compatible licenses. For complete copyright and license information, see the file LICENSE in the newsyslog source distribution.

Last spun 2022-02-06 from thread modified 2018-08-19