Linux 101 : Logs and disk space


If our log directory "/var/log" is using up a lot of disk space, we could check the files that are consuming the space using the below command:


The above command lists all of the fi les sorted by their size.
We could erase the content of these files using the below command:


If one of the large files was rotated, it will have the ".3" or ".2" appended to it.

We could also change the settings of the "logrotate" in the following files "/etc/logrotate.conf" and "/etc/logrotate.d/" so that the rotated logs will be compressed.

Remark:

Log rotation is a system that allows files to be compressed, renamed and ultimately deleted after their retention period is up.

Comments

Popular posts from this blog

Istio 101 : How Istio ServiceEntry relates to Kubernetes Services and Endpoints

Kubernetes 101 : - Scaling a Stateful set -

Python 101 : Generators and Lists