Operating System - Linux
1819804 Members
3093 Online
109607 Solutions
New Discussion юеВ

Housekeeping of /var/log/lastlog on Linux

 
SOLVED
Go to solution
Eric Leung_2
Advisor

Housekeeping of /var/log/lastlog on Linux

Hi,

The /var/log/lastlog is really big. I think proper housekeeping is required but any guru can advise the proper way to do so. Can I use logrotate?

Thanks
2 REPLIES 2
Muthukumar_5
Honored Contributor
Solution

Re: Housekeeping of /var/log/lastlog on Linux

You can use logrotate with specialised script to archive + zipping files.

# tar -cvzf lastlog.$(date "%d_%m).tar /var/log/lastlog

If you have gunzip support then,
# tar -cvjf lastlog.$(date "%d_%m).tar /var/log/lastlog

# After the above step
> /var/log/lastlog

hth.


Easy to suggest when don't know about the problem!
Ermin Borovac
Honored Contributor

Re: Housekeeping of /var/log/lastlog on Linux

lastlog is a sparse file, so it's not that big (you can check its real size with du).

The following note comes from lastlog(8).

The lastlog file is a database which contains info on the last login of
each user. You should not rotate it. It is a sparse file, so its size
on the disk is much smaller than the one shown by ls -l (which can
indicate a really big file if you have a high UID). You can display its
real size with ls -s.