-- =========================================================== Theis Jean-Marie : l'indien du placard Tels : 7721 7527 4695 mail adress : theis_at_drfc.cad.cea.fr =========================================================== Je passe le plus clair de mon temps ą l'obscurcir. Boris Vian ===========================================================
-- +---+ Harald Klatte -------------------------------- From Guy Dallaire : What we do here is: a) Stop the binary logger + system logger (their pid's are in /var/run/) b) Make a copy of the current binary.errlog and var/adm/messages, remove older compressed copie(s) c) optionnaly compress it d) cat /dev/null > binary.errlog + var/adm/messages e) restart binary logger and syslog (/sbin/init.d/syslog) We do this every monday night, keeping three weeks of compressed logs. If we have to look at older logs, we uncompress them and use uerf -f option. If we need to go further back, we restore from a backup tape. Hope this helps. --------------------------------- From Randy Rodgers : I recently wrote a script that is executed by cron at 4:30 AM on Monday mornings that does the following: * Stop syslog * move binary error log file * start new binary log file * start syslog I have included this script below. I also have a cron entry that runs at 4:35 AM on Monday that removes the saved log files over 31 days old. ============================================================================ ============= #!/bin/ksh # # ***************** # * savebinerrlog * # ***************** # # Script: savebinerrlog # Written by: Randy Rodgers # Created: 09/05/97 # Purpose: Save/initialize the /var/adm/binary.errlog file. #=========================================================================== =============== # Modifications: # Date Who Reason # ---------- ------ ----------------------------------------------------------------------- #=========================================================================== =============== # Description: # The /var/adm/binary.errlog file continues to grow larger. This script will move the # file to /usr/local/logs/binerrlog/binary.errlog.yymmdd then initialize a new file. #=========================================================================== =============== # VARIABLE SECTION #=========================================================================== =============== # Command Variables #--------------------------------------------------------------------------- --------------- CAT="/sbin/cat" # cat DATE="/sbin/date" # date MV="/sbin/mv" # mv #--------------------------------------------------------------------------- --------------- # Script Variables #--------------------------------------------------------------------------- --------------- SYSLOG="/sbin/init.d/syslog" # start/stop syslog #--------------------------------------------------------------------------- --------------- # Date Variables #--------------------------------------------------------------------------- --------------- CDATE="$($DATE +"%y%m%d")" # Current date in yy/mm/dd format #--------------------------------------------------------------------------- --------------- # Directory/File Variables #--------------------------------------------------------------------------- --------------- BINERRLOG="/var/adm/binary.errlog" # Binary error log file BINLOGDIR="binerrlogs" # Binary error log file directory BINLOGFILE="binary.errlog.$CDATE" # Binary error log (saved) LOCALLOGSDIR="/usr/local/logs" # Local logs directory NULL="/dev/null" # null device file #=========================================================================== =============== # MAIN SECTION #=========================================================================== =============== $SYSLOG stop # Stop the binary error logger (syslog) $MV $BINERRLOG $LOCALLOGSDIR/$BINLOGDIR/$BINLOGFILE # Move binary error log file $CAT $NULL>$BINERRLOG # Start new binary error log file $SYSLOG start # Start the binary error logger (syslog) ============================================================================ ============= I hope this helps. ---------------------------------------- From kurt carlson : We have the following scheduled 3 time a year: #!/bin/ksh echo "/usr/local/sbin/new.errlog: create new date stamped binary.errlog" # #960430kc created: touch binary.errlog.YYMMDD and hard link binary.errlog #============================================================================== STAMP=`date +%y%m%d` # today's date as YYMMDD LOG_F=/var/adm/binary.errlog if [ -e ${LOG_F}.${STAMP} ]; then echo "${LOG_F}.${STAMP} already exists: " else set -x touch ${LOG_F}.${STAMP} # create new chgrp system ${LOG_F}.${STAMP} # let system read ln -f ${LOG_F}.${STAMP} ${LOG_F} # re-link it kill -HUP `cat /var/run/binlogd.pid` # restart binlogd fi ls -l ${LOG_F}* --------------------------------------- From Thomas P. Blinn: Move the file aside (e.g., mv /var/adm/binary.errlog /var/adm/binary.errlog.001) and then send a SIGHUP signal to the binlogd process (as described in the binlogd reference page: The binlogd daemon also creates the /var/run/binlogd.pid, if possible. The file contains a line that specifies the binlogd daemon's process identifi- cation number. Use this number to disable or reconfigure the binlogd daemon. To disable the binlogd daemon, send the process a SIGTERM signal. For example: kill -TERM `cat /var/run/binlogd.pid` To reconfigure the binlogd daemon, send the process a SIGHUP signal to cause it to read the configuration file again. For example: kill -HUP `cat /var/run/binlogd.pid` ) Tom ----------------------------------------- From Knut Hellebų 1. Stop syslog (/sbin/init.d/syslog stop) 2. Clean the errorlog the way you want (e.g 'cp /dev/null ...') 3. Start syslog ------------------------------------ Many thanks also to : Stefan Albert Kemal Gert Maaskant ....Received on Mon Oct 20 1997 - 14:56:37 NZDT
This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT