* SUMMARY : How to cut cleanly binary.errlog
@ 1997-10-20 9:09 Theis Jean-Marie 77-21 theis () pegase ! cad ! cea ! fr
0 siblings, 0 replies; only message in thread
From: Theis Jean-Marie 77-21 theis () pegase ! cad ! cea ! fr @ 1997-10-20 9:09 UTC (permalink / raw)
To: tru64-unix-managers
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="--------------167E2781446B", Size: 10408 bytes --]
This is a multi-part message in MIME format.
--------------167E2781446B
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
-- =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
Theis Jean-Marie : l'indien du placard
Tels : 7721 7527 4695
mail adress : theis@drfc.cad.cea.fr
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
Je passe le plus clair de mon temps =E0 l'obscurcir.
Boris Vian
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
--------------167E2781446B
Content-Type: text/plain; charset=iso-8859-1; name="remerciements"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="remerciements"
..many thanks to all : I have been overflowed with many responses ..
=
I have not given back all responses see below the most typical .
=
The question was :
=
> As the /var/adm/binary.errlog of my systems grows very fat I need to
> reduce their size , but I do not want to loose the last events by usin=
g
> "cp /dev/null binary.errlog" . =
> "tail -1000 etc... " is neither good as the new file starts with a
> corrupted entry ( fortunately dia or uerf can deal with it ).
> Is there a clean way to do that ???
> =
I forgot to precise that I wanted to keep the files in binary and not =
translated via uerf so tha I can give them to "dia" later.
from Harald Klatte :
mv /var/adm/binary.errlog /var/adm/binary.errlog.old
and
kill -HUP [uid of binlogd-process]
to reset that process.
A new /var/adm/binary.errlog will be created.
Without resetting the logging process it will still write to the .old fil=
e .
greetings
Harald
-- =
+---+ Harald Klatte =
--------------------------------
=46rom 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.
---------------------------------
=46rom 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.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#!/bin/ksh
#
# *****************=
# * savebinerrlog *=
# *****************=
#
# Script: savebinerrlog
# Written by: Randy Rodgers
# Created: 09/05/97
# Purpose: Save/initialize the /var/adm/binary.errlog file.
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# Modifications:
# Date Who Reason
# ---------- ------
-----------------------------------------------------------------------
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# Description:
# The /var/adm/binary.errlog file continues to grow larger. This scrip=
t
will move the
# file to /usr/local/logs/binerrlog/binary.errlog.yymmdd then initializ=
e
a new file.
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# VARIABLE SECTION
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# Command Variables=
#------------------------------------------------------------------------=
---
---------------
CAT=3D"/sbin/cat" # cat
DATE=3D"/sbin/date" # date
MV=3D"/sbin/mv" # mv
#------------------------------------------------------------------------=
---
---------------
# Script Variables
#------------------------------------------------------------------------=
---
---------------
SYSLOG=3D"/sbin/init.d/syslog" # start/stop sy=
slog
#------------------------------------------------------------------------=
---
---------------
# Date Variables
#------------------------------------------------------------------------=
---
---------------
CDATE=3D"$($DATE +"%y%m%d")" # Current date =
in
yy/mm/dd format
#------------------------------------------------------------------------=
---
---------------
# Directory/File Variabl=
es
#------------------------------------------------------------------------=
---
---------------
BINERRLOG=3D"/var/adm/binary.errlog" # Binary error =
log
file
BINLOGDIR=3D"binerrlogs" # Binary error =
log
file directory
BINLOGFILE=3D"binary.errlog.$CDATE" # Binary error =
log
(saved)
LOCALLOGSDIR=3D"/usr/local/logs" # Local logs
directory
NULL=3D"/dev/null" # null device f=
ile
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# MAIN SECTION
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
$SYSLOG stop # Stop the binary=
error logger (syslog)
$MV $BINERRLOG $LOCALLOGSDIR/$BINLOGDIR/$BINLOGFILE # Move binary err=
or
log file
$CAT $NULL>$BINERRLOG # Start new binar=
y
error log file
$SYSLOG start # Start the binar=
y
error logger (syslog)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
I hope this helps.
----------------------------------------
=46rom 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=
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
STAMP=3D`date +%y%m%d` # today's date as YYMMDD
LOG_F=3D/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}*
---------------------------------------
=46rom Thomas P. Blinn:
Move the file aside (e.g., mv /var/adm/binary.errlog /var/adm/binary.errl=
og.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 identi=
fi-
cation number. Use this number to disable or reconfigure the binlogd
daemon. To disable the binlogd daemon, send the process a SIGTERM sign=
al.
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
=
-----------------------------------------
=46rom Knut Helleb=F8
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
=2E...
--------------167E2781446B--
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-10-20 9:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-10-20 9:09 SUMMARY : How to cut cleanly binary.errlog Theis Jean-Marie 77-21 theis () pegase ! cad ! cea ! fr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox