# Clear Journald Logs

Journalctl can accumulate a lot of system logs over time being, we can clear the logs using `--vacuum-time` or `--vacuum-size` argument.

## Clear Logs by Time

Only retain last 3 days of logs:

```bash
journalctl --vacuum-time=3d
```

## Clear Logs by Size

Only retain 1 GB of logs:

```bash
journalctl --vacuum-size=1G
```

## Set Max Log Size

You can configure the max log size in `/etc/systemd/journald.conf`:

```ini
SystemMaxUse=1G
```

Then restart the journald service:

```bash
systemctl restart systemd-journald
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.devjugal.com/linux/journalctl/clear-journalctl-logs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
