coding-to-music / coding-to-music.github.io

https://pandemic-overview.readthedocs.io/en/latest/index.html
MIT License
2 stars 8 forks source link

How to Clear Systemd Journal Logs and Introduction to the Systemd journal #80

Open coding-to-music opened 3 years ago

coding-to-music commented 3 years ago

How to Clear Systemd Journal Logs https://linuxhandbook.com/clear-systemd-journal-logs/

  1. Clear journal log older than x days Keep in mind that logs are important for auditing purpose so you should not delete all of them at the same time. Let’s say you want to keep the log history of just two days. To delete all entries older than two days, use this command:

sudo journalctl --vacuum-time=2d https://linuxhandbook.com/clear-systemd-journal-logs/

tmc@penguin:/var/log/journal/5c03540939c875030dd8cbfd601ef925$ du -sh /var/log/journal/ 96M /var/log/journal/ tmc@penguin:/var/log/journal/5c03540939c875030dd8cbfd601ef925$ journalctl --disk-usage Hint: You are currently not seeing messages from other users and the system. Users in the 'systemd-journal' group can see all messages. Pass -q to turn off this notice. Archived and active journals take up 48.0M in the file system. tmc@penguin:/var/log/journal/5c03540939c875030dd8cbfd601ef925$ sudo journalctl --rotate tmc@penguin:/var/log/journal/5c03540939c875030dd8cbfd601ef925$ sudo journalctl --vacuum-time=2d Vacuuming done, freed 0B of archived journals from /run/log/journal/5c03540939c875030dd8cbfd601ef925. Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/system@0005c2c7da1571f5-1161c48afab9bc12.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/user-1000@0005c2c7da565fbe-f31b22c4391194d6.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/system@0005c2c8e84c4fe8-965d51849c92995d.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/user-1000@0005c2c8e89b49bd-a3b3e9b1f93bc591.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/system@0005c2f2e078861a-7b68656cdf80270a.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/user-1000@0005c2f2e0dd7e84-457003c915cc4142.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/system@0005c30ae6183615-0166f1cd584c06bb.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/user-1000@0005c30ae684652a-bd10e0ee0dec960f.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/system@0005c348f517cb5a-c21b0c4e4f04203d.journal~ (8.0M). Deleted archived journal /var/log/journal/5c03540939c875030dd8cbfd601ef925/user-1000@0005c348f54ff0c7-1aa867f15a957476.journal~ (8.0M). Vacuuming done, freed 80.0M of archived journals from /var/log/journal/5c03540939c875030dd8cbfd601ef925.

coding-to-music commented 3 years ago

The whole article is good https://linuxhandbook.com/clear-systemd-journal-logs/

Introduction to the Systemd journal https://linuxconfig.org/introduction-to-the-systemd-journal