- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sizes of wtmp & btmp too large
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 10:09 AM
тАО05-25-2001 10:09 AM
sizes of wtmp & btmp too large
I recently noticed a low amount of space in /var. I the process of trying to clean up some old files, I came across wtmp and btmp. Both of these files are pretty large (wtmp is over 90 Meg.) Since I can't vi the files to trim them down, what would be the best method. If I removed them and than touch them, would there be any repercussions. Also, is there an easy way to automatically trim them in the future?
Thanks,
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 10:22 AM
тАО05-25-2001 10:22 AM
Re: sizes of wtmp & btmp too large
To trim them to an empty file do this:
# cat /dev/null > /var/adm/wtmp
# cat /dev/null > /var/adm/btmp
If you never want them built, remove them entirely. This shuts off the logging functions when (at least) an empty file doesn't exist.
If you want to analyze and manage these files in a more rigorous manner, take a look at 'acctcon' (man 1M) and 'fwtmp' (man 1M).
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 10:24 AM
тАО05-25-2001 10:24 AM
Re: sizes of wtmp & btmp too large
>wtmp
>btmp
This will set the file size back to zero while the file is still open. If you have problems with these files getting large, you could probably put something like this into cron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 10:25 AM
тАО05-25-2001 10:25 AM
Re: sizes of wtmp & btmp too large
You can truncate them with these commands:
>/var/adm/wtmp
>/var/adm/btmp
But before you do that, please understand that these files contain the history of logins to your server. In other words, these files are used by commands like 'last' and 'finger' to tell you who, when and from where has been in your server. We usually keep 3 months worth of history at all times.
You can copy these files to a filesystem with more space and still be able to access its information, for ex:
last -f /otherfs/wtmp
HTH,
Luis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 11:00 AM
тАО05-25-2001 11:00 AM
Re: sizes of wtmp & btmp too large
I trim my system logs every week manually to keep a constant check on things. Here's how I do it:
Trim system logs:
Logon as root
Sam (return)
routine tasks (return)
system logfiles (ret)
Highlight /var/adm/btmp
/var/adm/wtmp
Tab->Actions->Trim->Trim to zero
Exit
Lisa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 11:23 AM
тАО05-25-2001 11:23 AM
Re: sizes of wtmp & btmp too large
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 11:29 AM
тАО05-25-2001 11:29 AM
Re: sizes of wtmp & btmp too large
#!/usr/bin/ksh
set -x
print " get wtmp in ascii format"
/usr/sbin/acct/fwtmp
print "edit wtmp "
sleep 3
vi /var/tmp/wtmp.out
print "put it back in binary format"
/usr/sbin/acct/fwtmp -ic < /var/tmp/wtmp.out >wtmp
print " remove ascii file then verify wtmp"
sleep 3
rm /var/tmp/wtmp.out
read ans?"Verify ? y/[n] "
[[ $ans = [yY] ]] &&
/usr/sbin/acct/fwtmp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 02:04 PM
тАО05-25-2001 02:04 PM
Re: sizes of wtmp & btmp too large
Someone said" they trim these logs weekly to keep a constant check on things". Since these are the system accounting logs, anyone who Just trims them really has not a clue of what is going on on their system!!!
If you want to know what is going on on your system I recommend to Administrators to enable accounting, and view accounting results before just removing them.
If you process accounting, the accounting processes zero out these files for you, convert to C format, and make some nice readable text for you. To setup accounting, do this.
>vi /etc/rc.config.d/acct
change START_ACCT=0 to START_ACCT=1
* this starts accounting at boot time.
Next, run "/usr/sbin/acct/startup" This will set things up, and turn on the accounting systems.
Next, vi /etc/acct/holidays. Probably only have to change the year, but you can setup quite a bit there.
Next add this entry to cron
01 00 * * * * /usr/sbin/acct/runacct;/usr/sbin/acct/ckpacct
runacct will run your daily accounting. ckpacct will check to see if disk is full, and disable accounting if it is.
Your easiest data to process by printing or paging is under /var/adm/acct/sum and will be called rprt$MM$DD where $MM is the 2 digit month, and $DD is the 2 digit day of the month.
It is recommended that you enable the accounting as the user "adm" and also have the user "adm" launch the accounting process scripts.
Of course, read the man pages, because the accounting is very powerfull, and provides a lot of information about activity on your system. Most of this information is in the reports, but there is alot in the raw C files too!
I find it quite amazing how many admins just blow away the accounting files, oblivious to the data they can provide! Especially when they can never say why things happen on their servers and complain about the OS!
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2001 06:24 PM
тАО05-25-2001 06:24 PM
Re: sizes of wtmp & btmp too large
Many respondants have suggested trimming the wtmp file to zero bytes. In my experience, 5 minutes after doing so you will want the data you just removed.
I suggest the following in a cron job:
cp /var/adm/wtmp /var/adm/wtmp.old
cat /dev/null > /var/adm/wtmp
Thus, if you run this monthly, you will always have at least one month's worth of data but never more than two.
--Bruce