1819805 Members
3318 Online
109607 Solutions
New Discussion юеВ

can i delete the logs

 
SOLVED
Go to solution
bunty.....
Frequent Advisor

can i delete the logs

hi friends,
can i delete the some log entries from /var/adm/syslog/syslog.log file.

if yes, then how can i?

thanks
bunty
9 REPLIES 9
Peter Godron
Honored Contributor
Solution

Re: can i delete the logs

bunty,
syslog.log is used by some reporting tools, but old entries can be deleted.
You could use sam or tail records manually.
Example:
tail -1000 syslog.log > x.x
cp x.x syslog.log
MarkSyder
Honored Contributor

Re: can i delete the logs

I trim the syslog every day by going into SAM, routine tasks. Trim the syslog.log to its recommended size. This nulls the syslog.log having copied it to a file called syslog.SAMTRM, retaining only the most recent entries.

But in your case, I would leave the syslog.log alone until your disc is working - you might need to refer to it. Talking of which, you haven't told us how you're getting on with that disc in a while.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Pete Randall
Outstanding Contributor

Re: can i delete the logs

Use SAM > Routine Tasks > System Log Files or you can reboot the system. During the reboot, the syslog file is copied to OLDsyslog and a new one is started.


Pete

Pete
Raj D.
Honored Contributor

Re: can i delete the logs

Bunty ,

You should not delete the file , but you can nulligy the log files to recover space.

# > /var/adm/syslog/syslog.log
# > /var/adm/syslog/mail.log

Enjoy ,
Cheers,

Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Geoff Wild
Honored Contributor

Re: can i delete the logs

Here's what I do to clean up ftp for example (I'm not using default ftp - so no one chirp in about ftp -l in inetd.conf).

# cat get-rid-of-ftp-syslog
#!/bin/sh

# script to zero out the syslog and make a bacup of it without ftp logs
# gwild
DIR=/var/adm/syslog

cp -p $DIR/syslog.log $DIR/syslog.log.bak
> $DIR/syslog.log

sed -n '/ftp/!p' $DIR/syslog.log.bak > $DIR/syslog.log.noftp.`date +%b%d%H%M`


Also, logrotate may help you as well:

http://hpux.ee.ualberta.ca/hppd/hpux/Sysadmin/logrotate-2.5/

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: can i delete the logs

BTW - the logrotate even works on HP-UX Itanium.

I configured like so:

# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 5

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/adm/wtmp {
monthly
create 0664 adm adm
rotate 1
}

# system-specific logs may be also be configured here.


# ll /etc/logrotate.d
total 48
-rw-r--r-- 1 root sys 65 May 19 2004 maillog
-rw-r--r-- 1 root sys 65 Mar 14 2005 named.log
-rw-r--r-- 1 root sys 161 Aug 19 2004 syslog


# cat /etc/logrotate.d/maillog
/var/adm/syslog/mail.log {
rotate 5
weekly
}


# cat /etc/logrotate.d/named.log
/var/adm/named/named.log {
rotate 5
weekly
}

# cat /etc/logrotate.d/syslog
/var/adm/syslog/syslog.log {
rotate 5
weekly
postrotate
/usr/bin/kill -HUP `ps -ef |grep syslogd |awk '{print $2}'` || true
endscript
}


And in cron:

# logrotate
0 0 * * * /opt/logrotate/bin/logrotate /etc/logrotate.conf >/tmp/logrotate.cron 2>&1


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
rodh_z
Advisor

Re: can i delete the logs

yes, u can.
1. touch /var/adm/syslog/syslog.log
2. chmod 644 /var/adm/syslog/syslog.log
3. /usr/sbin/syslogd -D
Nguyen Anh Tien
Honored Contributor

Re: can i delete the logs

Hi Bunty.
==
You can backup it by tar command
#tar cvf /path/newfile /var/adm/syslog/syslog.log
Trim file:
#>/var/adm/syslog/syslog.log
But I highly recommend you use logrotate
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-2.5/
to rotate your log.
========================
your question is the same as:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=991878
pls find other and my answer !
HTH
tienna
HP is simple
Joel Girot
Trusted Contributor

Re: can i delete the logs

Hi Bunty,
Here a good ksh script found on this forum some time ago. It rotate log files based on size, lifespan, It allow compression, manage the "old" files log generated by the system (eg OLDsyslog.log vs syslog.log), the number of copies to maintain, the security parameters to be applied to the files with chmod and chown. You can easily add or remove the log files which you wish to manage. This script already contains the majority of the basic hpux 11.11 log files. It is simple, easy to adapt and deserves to be examined.
Regards, Joel