1. CONVERT WTMP FILE TO A TEXT FILE AND REMOVE UNWANTED ENTRIES
WE CAN USE MOST OF THE LOG FILES TO COMPRESS WITH THE SAME PROCEDURE
/usr/sbin/acct/fwtmp </var/adm/wtmp >/tmp/wtmp.out
Trim wtmp.out
for example to calculate number of lines
# cat /tmp/wtmp.out|wc -l
914
To trim only last 300 lines
tail -300 /tmp/wtmp.out >> /tmp/wtmp1.out
2. CONVERT THE TEXT FILE TO WTMP FORMAT AND COPY TO THE DEFAULT LOCATION
/usr/sbin/acct/fwtmp -ic <wtmp1.out >/var/adm/wtmp
3. REMOVE UNWANTED FILES
rm /tmp/wtmp1.out
rm /tmp/wtmp.out
4. WE CAN COMPRESS WTMP LOG
cp /var/adm/wtmp /tmp
compress /tmp/wtmp
or gzip -9 /tmp/wtmp
cp /tmp/wtmp.Z /var/adm/
cp /dev/null /var/adm/wtmp
No comments:
Post a Comment