Log - Rotation

Data System Architecture

About

log Rotation

Log File Rotation

Bash

# First Parameter is the log file
# Second parameter is the log number
rotate_log ()
{
    log=$1;
    num=5;
    if [ -n "$2" ]; then
    num=$2
    fi
    if [ -f "$log" ]; then # rotate logs
    while [ $num -gt 1 ]; do
        prev=`expr $num - 1`
        [ -f "$log.$prev" ] && mv -f "$log.$prev" "$log.$num"
        num=$prev
    done
    mv -f "$log" "$log.$num";
    fi
}

logrotate

See logrotate application





Discover More
Java Conceptuel Diagram
Java Logger - Logback

logback is a logging system. where, there is: one that write to the console with the message format %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}...
Data System Architecture
Log - Logging

A log is a text file with: a timed list of message (activities) that an application has performed execution/request log: web server: web log ( - that stores the Http request error cron...
Data System Architecture
Log - logrotate app

logrotate is an application running as a linux service that allows: * automatic rotation, * compression * removal, * and mailing of log files. Each log file may be handled daily, weekly, monthly,...



Share this page:
Follow us:
Task Runner