Clean way to remove /var/adm/messages and /var/adm/syslog

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Sergei Naumo » Fri, 06 Jun 1997 04:00:00



Hi!
What's the proper way to remove the files (in subj)? Kill syslogd,
remove them and start it over again?

Thanks

--
++++++++++++ http://sunsite.oit.unc.edu/sergei/Me/Serge.html ++++++++++

+Department of Physics & Astronomy, UNC-CH, Chapel Hill, NC 27599, USA+
++++++++++++++++++ !! 8 bit (Cyrillic) mail accepted !!++++++++++++++++

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Peter Horto » Fri, 06 Jun 1997 04:00:00




> Hi!
> What's the proper way to remove the files (in subj)? Kill syslogd,
> remove them and start it over again?

> Thanks

cat /dev/null > /var/adm/messages

--
Peter Horton

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Leonard Blank » Sat, 07 Jun 1997 04:00:00



 >>
 >>
 >> Hi!  What's the proper way to remove the files (in subj)? Kill
 >> syslogd, remove them and start it over again?
 >>
 >> Thanks
 >>
 >>

 PH> cat /dev/null > /var/adm/messages

Or use the shorter

 > /var/adm/messages

You might look for a package called "cleanlog" somewhere within the
Sunsite archives, as it provides a more reasonable method in dealing
with growing system log files.

Run as a cron job, it gzips the current log file, empties it for the
next cycle and keeps two or three previous compressed versions around.

It solves the problem of disk space usage and saves this important
information. Deletion of log files is not recommended.
--
Len

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by G. Sumner Hay » Sat, 07 Jun 1997 04:00:00



LB:  PH> cat /dev/null > /var/adm/messages
LB:
LB: Or use the shorter
LB:
LB:  > /var/adm/messages
LB:

That'll only work with some shells (sh and ksh-derived ones).  The first
one should be portable to sh, csh, ksh, and rc-style shells.

'course, everyone should be using an sh/ksh style shell.  That doesn't
mean that they are, though...

TTFN,

  Sumner

--

  Apologies to legitimate repliers.

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Perry Donh » Sat, 07 Jun 1997 04:00:00


    Sergei> Hi!  What's the proper way to remove the files (in subj)?
    Sergei> Kill syslogd, remove them and start it over again?

I usually do:

        >/var/adm/messages
        >/var/adm/syslog

This retains the inode info, so there's no need to restart the logger
processes.

Perry

--
----------------------------------------------------------------------

                      PGP encrypted mail welcome
            Visit KidPub!  http://www.kidpub.org/kidpub

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Jim Staffo » Mon, 09 Jun 1997 04:00:00



: >
: >
: > Hi!
: > What's the proper way to remove the files (in subj)? Kill syslogd,
: > remove them and start it over again?
: >
: > Thanks
: >
: >

: cat /dev/null > /var/adm/messages

I just delete them then make a new file with the same name. Example
delete messages then use vi or whatever to make a new file called
messages. Never had a problem doing it this way.

jamess

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by M Predd » Mon, 09 Jun 1997 04:00:00






> : >
> : >
> : > Hi!
> : > What's the proper way to remove the files (in subj)? Kill syslogd,
> : > remove them and start it over again?
> : >
> : > Thanks
> : >
> : >

> : cat /dev/null > /var/adm/messages

> I just delete them then make a new file with the same name. Example
> delete messages then use vi or whatever to make a new file called
> messages. Never had a problem doing it this way.

> jamess

I tried that once...the logging processes stopped.  Touching new files
didn't work either.  Linux 1.2.7.

Mark

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Omegama » Tue, 10 Jun 1997 04:00:00



> I tried that once...the logging processes stopped.  Touching new files
> didn't work either.  Linux 1.2.7.

I run the following shell script periodically as a cron job.  There
are more elegant solutions (see this months Linux Gazette) but this
works fine for me.  Deleting the files will stop logging as the inode
information is lost.  You'd have to restart syslogd in that case.

---cut
jolietjake:~$ cat swaplogs
#!/bin/sh
/bin/rm /var/adm/*.oldlog
cp /var/adm/messages /var/adm/messages.oldlog
cat /dev/null >/var/adm/messages

cp /var/adm/syslog /var/adm/syslog.oldlog
cat /dev/null >/var/adm/syslog

cp /var/adm/debug /var/adm/debug.oldlog
cat /dev/null >/var/adm/debug

cp /var/adm/diald.log /var/adm/diald.oldlog
cat /dev/null >/var/adm/diald.log

cp /var/adm/session.log /var/adm/session.oldlog
cat /dev/null >/var/adm/session.log

---cut

Your specific log files will differ, of course.

me
--
---------------------------------------------------------------------

   PGP Key fingerprint =        | How are you gonna come?
   6D 31 C3 00 77 8C D1 C2      | With your hands upon your head,  
   59 0A 01 E3 AF 81 94 63      | Or on the trigger of your gun?"
Send email with "get key" as the| -- The Clash, "Guns of Brixton"
"Subject:" to get my public key |   _London_Calling_ , 1979
---------------------------------------------------------------------

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Geoff Sho » Wed, 11 Jun 1997 04:00:00


:
: What's the proper way to remove the files (in subj)? Kill syslogd,
: remove them and start it over again?

mv /var/adm/messages /some/where/else/
killall -HUP syslogd

        Geoff
--
----------------------------------------------------------------------------
Ever sit and watch ants? They're always busy with                Geoff Short

can't identify with that kind of work ethic. http://kipper.york.ac.uk/~geoff

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Marius van Wyk (Remove » Wed, 11 Jun 1997 04:00:00





>:
>: What's the proper way to remove the files (in subj)? Kill syslogd,
>: remove them and start it over again?

>mv /var/adm/messages /some/where/else/
>killall -HUP syslogd

How about:
cd to /var/adm
(optionally back these files up...)
then type:
:> messgaes
:> syslog
and that would make them 0 size, without disturbing it's inode too
much :)

-- Marius van Wyk

.. Stop reading now

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Laurent Aphecetch » Wed, 11 Jun 1997 04:00:00






> >:
> >: What's the proper way to remove the files (in subj)? Kill syslogd,
> >: remove them and start it over again?

> >mv /var/adm/messages /some/where/else/
> >killall -HUP syslogd

> How about:
> cd to /var/adm
> (optionally back these files up...)
> then type:
> :> messgaes
> :> syslog
> and that would make them 0 size, without disturbing it's inode too
> much :)

I agree, but this only work for bash shell...

--

GANIL, B.P. 5027, 14076, Caen Cedex 5, France
Vox: +33 (0)2 31 45 45 85 - Fax: +33 (0)2 31 45 46 65        
WWW: http://ganp03.in2p3.fr

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Giles Cooche » Fri, 13 Jun 1997 04:00:00



> : Hi!
> : What's the proper way to remove the files (in subj)? Kill syslogd,
> : remove them and start it over again?

> This is my prefered method, a one-liner in root's crontab:
> (broken down for readability)

>    19 2 * * * find /var/log -name syslog -size +70k
>    -exec mv {} {}.o \; -exec touch {} \;
>    -exec kill -1 `cat /var/run/syslogd.pid` \;

I'm sure you can use tail to keep just the most recent 64k of the messages
file,
there are also other utilities which will archive the files to a WORM drive
or compress and rename them with the date once they get so long.
 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Rob S. Wolfr » Mon, 23 Jun 1997 04:00:00





>> How about:
>> cd to /var/adm
>> (optionally back these files up...)
>> then type:
>> :> messgaes
>> :> syslog
>> and that would make them 0 size, without disturbing it's inode too
>> much :)

>I agree, but this only work for bash shell...

I think you are mistaken. This works for the whole Bourne tree of shells
and at least also for 'tcsh'. I'm not sure about 'csh' (I have no copy
of that one). ':' stands for the shell built-in replacement of 'true'.

Cheers,
Rob.

--

W3:                                       http://www.flnet.nl/~0wolfram01
=========================================================================
L I N U X :   T H E   C H O I C E   O F   A   G N U   G E N E R A T I O N
=========================================================================
Micro$oft is not the answer; Micro$oft is the question. The answer is NO.
=========================================================================

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Ville Kiiskin » Tue, 24 Jun 1997 04:00:00




>:
>: What's the proper way to remove the files (in subj)? Kill syslogd,
>: remove them and start it over again?

>mv /var/adm/messages /some/where/else/
>killall -HUP syslogd

        Isnt it easier jus say :>/var/adm/messages
        it will truncate the file to 0 bytes ... and no need to
        restart syslogd.

++Sergei

 
 
 

Clean way to remove /var/adm/messages and /var/adm/syslog

Post by Jeff Ada » Wed, 02 Jul 1997 04:00:00





>>:
>>: What's the proper way to remove the files (in subj)? Kill syslogd,
>>: remove them and start it over again?

>>mv /var/adm/messages /some/where/else/
>>killall -HUP syslogd

>    Isnt it easier jus say :>/var/adm/messages
>    it will truncate the file to 0 bytes ... and no need to
>    restart syslogd.
>++Sergei

We do it every night via cron. Here's the line for the message file
(the syslog file is similar) -

06 02 * * * find /var/adm/messages -size +10k -exec mail -s "{}" root
< /var/adm/messages \; -exec cp /dev/null {} \;

Jeff


<Jeff Adams>