- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How do I prune wtmp and btmp?
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
тАО08-31-2001 01:19 PM
тАО08-31-2001 01:19 PM
Ideally, I would like to remove information that is older than a month or so. If it is a simple command line I could use cron.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2001 01:26 PM
тАО08-31-2001 01:26 PM
Re: How do I prune wtmp and btmp?
cat /dev/null > /var/adm/wtmp
cat /dev/null > /var/adm/btmp
i do this after copying wtmp and btmp elsewhere for backup/history purposes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2001 01:35 PM
тАО08-31-2001 01:35 PM
SolutionTo null the file entirely and start fresh:
# cat /dev/null > /var/adm/wtmp
To trim it to your liking, retaining some data do:
# /usr/sbin/acct/fwtmp < /var/adm/wtmp > /tmp/wtmp
At this point, you may edit the /tmp/wtmp file, since it is a ASCII file and then convert it back to binary.
# /usr/sbin/acct/fwtmp -ic < /tmp/wtmp > /var/adm/wtmp
You can do the same for the 'btmp' data.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2001 01:36 PM
тАО08-31-2001 01:36 PM
Re: How do I prune wtmp and btmp?
#cp /var/adm/btmp /your_backup_dir/
#compress /your_backup_dir/btmp
If you want you can use log rotation method.
The same case for wtmp
#cat /dev/null > /var/adm/btmp
#cat /dev/null > /var/adm/wtmp
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2001 01:38 PM
тАО08-31-2001 01:38 PM
Re: How do I prune wtmp and btmp?
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2001 01:41 PM
тАО08-31-2001 01:41 PM
Re: How do I prune wtmp and btmp?
I also do the same as mark does.
cat /dev/null > /var/adm/wtmp
cat /dev/null > /var/adm/btmp
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2001 01:43 PM
тАО08-31-2001 01:43 PM
Re: How do I prune wtmp and btmp?
-Kathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2001 02:26 PM
тАО08-31-2001 02:26 PM
Re: How do I prune wtmp and btmp?
Here is a script that I use that clears allot of the main logs. wtmp btmp cron log syslog.log
mail.log I set up in cron like this with crontab -e
58 23 * * * /usr/local/bin/dailylogs.sh TRACE# Daily log clear script
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2001 10:56 AM
тАО09-01-2001 10:56 AM
Re: How do I prune wtmp and btmp?
It's best to scan wtmp and btmp with last abd lastb (respectively) and save off any useful information. Then zero these binary files, probably every 6 months is useful.
Bill Hassell, sysadmin