[logs] Tape backup

From: Pier Luigi Rotondo (pierluigirotat_private)
Date: Sat Dec 22 2001 - 01:20:38 PST

  • Next message: Ganu Skop: "[logs] pf log"

    >ALMEIDA Antonio Jose <ajalmeidaat_private> wrote:
    
    >Can someone give me some advices about logg backup? Since we don't need to have the
    
    > logs in the disk forever (and we can't!), what's the best way to implement tape rotation?
    
    >Antonio
    
    
    
    Antonio,
    
    Below I cut for you pieces from a script that I run daily on my centralized syslog server. It runs on a IBM RS/6000 server and basically it stores all the aggregated logfiles for each day on a local directory and, what you asked to see, archives the logfile for the day on an attached DDS3 tape (at the very end of the script).
    
    I worked out the trick to fully rewind the tape and jump to the very last record each time before writing the record so you can eject the tape during the day without the worry for correct positioning on the tape.
    
    In my case the local retention policy is to keep backups for at least 90 days so I have two tapes that I manually rotate every 90 days. Regarding physical protection, the log servers is in a controlled (access+fire detection) area, while the unused tape is stored in a off-site fire-proof safe.
    
    
    
    I hope it helps.
    
    
    
    Regards,
    
    Pier Luigi Rotondo
    
    
    
    
    
    [...]
    
    ##################################################
    
    ARCHIVER=/usr/local/bin/gzip
    
    ARCHIVEREXTENSION=.gz
    
    # Archive logfile in a directory in local hard disk
    
    ARCHIVENAME=logs-`date +%Y%m%d`.tar
    
    cd $LOGDIR/tmp
    
    tar cvf $LOGDIR/$ARCHIVENAME *
    
    $ARCHIVER $LOGDIR/$ARCHIVENAME
    
    # Warning: from now on the file has a different name! i.e. file.tar -> file.tar$ARCHIVEREXTENSION
    
    chown root:security $LOGDIR/$ARCHIVENAME$ARCHIVEREXTENSION
    
    chmod u=r,go= $LOGDIR/$ARCHIVENAME$ARCHIVEREXTENSION
    
    rm $LOGDIR/tmp/*
    
    ##################################################
    
    
    
    [...]
    
    
    
    ##################################################
    
    # archive logfile on an external tape
    
    # Note: before writing a new record, the tape is rewinded and then positioned to
    
    # the first available position. Tapes can therefore be extracted and inserted
    
    # without the worry to overwrite old records
    
    TAPENAME=/dev/rmt0.1
    
    # rewind the tape
    
    mt -f $TAPENAME
    
    # jump to first available record
    
    mt -f $TAPENAME fsf 1000 2>/dev/null
    
    cd $LOGDIR
    
    tar cvf /dev/rmt0.1 $ARCHIVENAME$ARCHIVEREXTENSION
    
    ##################################################
    



    This archive was generated by hypermail 2b30 : Sat Dec 22 2001 - 09:18:57 PST