Rotar log journalctl

He decidido chequear cuanto disco duro están ocupando los logs de sistema del linux.

Vemos que journalctl ocupa la mayor parte de eses espacio.

Lo podemos revisar con el comando:

journalctl --disk-usage
Archived and active journals take up 3.9G in the file system.

Para borrarlos ponemos usar el comando

journalctl --vacuum-time=TIME 

Siendo TIME el tiempo de antiguedad superior a la cual serán borradas las entradas:

--vacuum-time=1s (Borrará todo más antiguo de 1 segundo)
--vacuum-time=1m (Borrará lo más antiguo de 1 minuto)
--vacuum-time=12h (Doce horas)
--vacuum-time=4weeks (4 semanas)
--vacuum-time=12months (12 meses)

Así, en mi caso he decidido dejar solo 72 horas:

sudo journalctl --vacuum-time=72h

Deleted archived journal /var/log/journal/7817d77312ee47c39d51b2a10a1d1177/system@029ef2f313214d50a736151116993c74-000000000002f5cc-0005a69f5e6ac95c.journal (8.0M).
Deleted archived journal /var/log/journal/7817d77312ee47c39d51b2a10a1d1177/user-1001@dd873ee0dea845ba86878421599d68cc-000000000005775a-0005a69f65d42ab7.journal (128.0M).
Deleted archived journal /var/log/journal/7817d77312ee47c39d51b2a10a1d1177/system@029ef2f313214d50a736151116993c74-000000000005d23e-0005a69f681b860d.journal (8.0M).....
.......
.....
...
..

Vacuuming done, freed 3.7G of archived journals from /var/log/journal/7817d77312ee47c39d51b2a10a1d1177.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s