Giter VIP home page Giter VIP logo

logs's Introduction

logs - write and roll logs

based in part on savelog in debianutils

A shell script for writing and rolling logs.

Installation

Plop the script in your bin directory or on your PATH somewhere. It requires bash.

Usage

This script writes out standard input to a specified log file, but also handles rolling over old copies of the log file each time it is run. Use it instead of redirecting to a log file; instead of:

<command> > output.log

do this:

<command> | logs output.log

This script runs as long as standard input can be read, so when the feeding command exits, it does too.

When this script starts, it renames old logs, keeping up to a maximum number (default 10) around, with the oldest having the highest number in its name. The sequence is:

output.log -> output.log.0.gz -> output.log.1.gz -> ... -> output.log.n-1.gz

By default, old logs are compressed using gzip, but different compression or none at all may be employed.

Run the script with -h to see all the available options.

Limitations

  • If a new log directory is chosen between runs, log rotation starts over. Logs in the old log directory are left alone.
  • If the maximum count is reduced between runs, old logs with numbering greater than one less than the new maximum count are not removed.
  • The compression tool must be able to take in the file to compress as its sole argument, and compress it in place. gzip, bzip2, xz, and compress all qualify.
  • The user, group, and mode of old log files are never changed.

logs's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.