You've already forked journal-log-ubuntu
105 lines
2.0 KiB
Markdown
105 lines
2.0 KiB
Markdown
|
|
# Journal Log Auto-Cleanup for Ubuntu 24.04 Server
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](./LICENSE)
|
|||
|
|
|
|||
|
|
Auto-cleanup systemd journal logs on Ubuntu 24.04 server.
|
|||
|
|
|
|||
|
|
This is not a test script.
|
|||
|
|
This is designed for stable long-term use with predictable disk usage.
|
|||
|
|
|
|||
|
|
## Why this installer exists
|
|||
|
|
System logs grow silently until they cause trouble. This prevents that automatically.
|
|||
|
|
|
|||
|
|
## What this installer does
|
|||
|
|
✔ Weekly rotation + vacuum cleanup
|
|||
|
|
✔ Keeps only last 3 days of logs
|
|||
|
|
✔ Lightweight, hands-off operation
|
|||
|
|
✔ Fully automated via cron
|
|||
|
|
|
|||
|
|
## What this installer does *NOT* do
|
|||
|
|
It won’t stop you from running the script without reading the documentation like there’s no tomorrow.
|
|||
|
|
Skip the README, and whatever happens next is your headache, not a bug report.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 1. Download
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
git clone https://git.x-files.dk/server/journal-log-ubuntu.git
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
cd journal-log-ubuntu
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 2. Install
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
sudo ./journal-log-ubuntu
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
This creates a cron-executed cleanup script at:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
/usr/local/sbin/clear-journal-log
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
and registers a weekly schedule under:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
/etc/cron.d/clear-journal-log
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 3. Schedule Details
|
|||
|
|
|
|||
|
|
Cleanup runs automatically:
|
|||
|
|
|
|||
|
|
| Action | When |
|
|||
|
|
|---|---|
|
|||
|
|
| Journal rotation + vacuum | Every Sunday @ 02:00 |
|
|||
|
|
| Log retention window | 3 days |
|
|||
|
|
| Output log | `/var/log/clear-journal.log` |
|
|||
|
|
|
|||
|
|
You don't need to add cron jobs — installer handles everything.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 4. Verify Log Rotation
|
|||
|
|
|
|||
|
|
Check last run:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
cat /var/log/clear-journal.log
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
You should see:
|
|||
|
|
|
|||
|
|
✔ size before cleanup
|
|||
|
|
✔ size after cleanup
|
|||
|
|
✔ timestamped header + footer
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### Post-Install
|
|||
|
|
|
|||
|
|
Nothing else required — scheduling is automatic.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### More Information
|
|||
|
|
|
|||
|
|
More guides and documentation can be found on [wiki.x-files.dk](https://wiki.x-files.dk)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### License
|
|||
|
|
Licensed under the [MIT License](./LICENSE).
|
|||
|
|
|
|||
|
|
---
|