1751789 Members
4685 Online
108781 Solutions
New Discussion юеВ

last log

 
SOLVED
Go to solution
heaman1
Regular Advisor

last log

I know the command "last" can show the user login record , so now when I use this command , it shows the user login record in this half year ( I didn't clear it for half year ) , can advise if I want clear the old record so that it only show the record from 1-feb-09 ( that mean clear the record before 1-feb-09 ) , what can i do ?
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: last log

Shalom,

Once a month or quarter or some time period:

> /var/log/btmp
> /var/log/wtmp

Back them up first if you want.

Those are the data files for lastb and last commands respectively.

The command empties them out.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Ferreira
Honored Contributor

Re: last log

You can use logrotate for rotating the logs and having only a specific period of time on them.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
heaman1
Regular Advisor

Re: last log

thx replis,

> seems reset the file , the data will totally lost , but I just want remove the data before 1-feb

logrotate needs to config sth , but I just want to do it one time only, is there simplier method ? thx
heaman1
Regular Advisor

Re: last log

I know I can use last -f wtmp to export the file to text , then I can modify it , but how can I import back it to current wtmp ?
Vitaly Karasik_1
Honored Contributor

Re: last log

BTW, I suggest to assing points for answers - for now there is "0 points for 64 answers" :-(
Dennis Handly
Acclaimed Contributor
Solution

Re: last log

Do you have utmpdump? Does it have an option to write a wtmp file?
You may have to write your own fwtmp.