Git Product home page Git Product logo

log-file-cleaning's Introduction

Log file cleaning script

This script deletes typical old log files, logrotate files, and similar log backups.

Please be certain you don't need these log files before you run this.

Syntax:

log-file-cleaning [path]

Example:

log-file-cleaning /var/log

The path default is /var/log which is typical on popular Unix systems.

You can customize the command by providing your own rm command as an environment variable.

Example:

rm="/bin/rm" log-file-cleaning

Specifics

This removes many kinds of log files.

File names that end with:

  • .bz2
  • .gz
  • .old
  • .bak
  • .backup
  • .log.[0-9]*
  • .[0-9]*.log

File names that match:

  • btmp.[0-9]*
  • dmesg.[0-9]*
  • mail.err.[0-9]*
  • syslog.[0-9]*
  • wtmp.[0-9]*
  • xferlog.[0-9]*

Any atop files.

  • atop/atop_[0-9]*

Any Mac OSX Apple System Log files:

  • asl/*.asl
  • DiagnosticMessages/*.asl

Implementation notes

This script aims to work even when a disk is full or commands are missing. For example, this scripts starts by deleting files one name by one name, rather than relying on more-sophisticated file globbing or using find.

This script source code aims to be descriptive and meaningful, so a systems administrator can easily comment out lines as needed, or add new lines easily without affecting any other lines.

If you are a developer who is creating a patch or pull request, please keep this code pattern, rather than trying to introduce features such as more globbing, loops, non-POSIX commands, etc.

Tracking

  • Command: log-file-cleaning
  • Version: 3.0.0
  • Created: 2012-12-09
  • Updated: 2016-08-27
  • Contact: Joel Parker Henderson ([email protected])
  • License: GPL

log-file-cleaning's People

Contributors

joelparkerhenderson avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.