For the log files in /var/log
,
it appears that the wtmp
and also the rotated wtmp.n
are not ASCII file and can only be read by the last
command, so if they are compressed, one has to first uncompress them and then use last -f ...
to read. The other compressed log files can be easily read using an editor such as emacs since they are ASCII text files.
Is there a way to set "compress" for all other logs files except the wtmp.n?
(I assume that if one uncomments the #compress
in the /etc/logrotate.conf
,
# uncomment this if you want your log files compressed
#compress
then all log files will be compressed, including the wtmp
.)
Thanks
Best Answer
/var/log/wtmp
is not a text file but it's not compressed either. It's a binary file and to decode it you need a dedicated tool calledrawtmp
available with the sac package.To access wtmp logs, type in a terminal:
Or to decode the first wtmp archive:
EDIT: To override
logrotate
compression settings forwtmp
you just need to edit the /etc/logrotate.conf file:To add the
nocompress
directive:From
logrotate
man page: