# Logs

> Where the Postern Hub writes its log for each install method, log levels and formats, what is and is not logged, the per-account security log, useful filters and what to include in a bug report.

Source: https://docs.posternmail.app/admin/logs/

The Hub writes what it does to its standard error. Where that ends up depends on how you
installed it. This page shows where to look, how to make the log more or less detailed, what
the Hub keeps out of it, and what to send along with a bug report.

## Where the log is

**Docker Compose:**
Docker collects the container's output:

```sh
cd ~/postern
docker compose logs -f hub
```

`-f` follows new lines; leave it out to print what is there and stop. `--since 1h` and
`--tail 200` limit the output.
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
systemd sends the output to the journal:

```sh
sudo journalctl -u postern-hub -f
```

`-f` follows new lines. `-b` limits to the current boot, `--since "1 hour ago"` to a time
range, `-n 200` to the last 200 lines.
**Desktop app (built-in Hub):**
The desktop app writes the built-in Hub's output to `logs/hub.log` in the app's data folder
(`~/Library/Application Support/Postern`, `%APPDATA%\Postern` or `~/.config/Postern`).
**Help → Open Log Folder** opens the folder. Each start of the Hub adds a line such as
`--- 2026-12-05T15:33:52.000Z starting ...`, and each stop `--- hub exited code=0 signal=null`.

The same folder holds `desktop.log` (the app itself) and `mail.log` (getting and sending mail on
this computer).

## Levels and formats

| Variable | Default | Values |
|---|---|---|
| `POSTERN_LOG_LEVEL` | `info` | `debug`, `info`, `warn` (or `warning`), `error`. Anything else counts as `info`. The `--log-level` flag does the same. |
| `POSTERN_LOG_FORMAT` | `text` | `text` or `json`. Anything else counts as `text`. |

`POSTERN_DEV=1` raises `info` to `debug`, but also relaxes security checks: never use it for that
reason alone.

| Level | What you see |
|---|---|
| `error` | Things that failed and need attention: a failed scheduled backup, a request that failed with a server error, a subsystem that stopped. |
| `warn` | Problems the Hub works around: a mailbox sync that failed and is retried, the first-run setup code, an ignored legacy `MC_*` setting, an unreachable sign-in provider. |
| `info` | Normal events: start, listen address, Hub set up, backup written, user deleted, mail copy mode changes, shutdown. |
| `debug` | Detail for tracking down a problem, such as each sync step of each mailbox and its duration. Noisy: turn it on only while you look. |

The `text` format is one line per event, with `key=value` pairs:

```text
time=2026-12-05T16:33:52.555+01:00 level=INFO msg=starting version="Postern Hub 0.9.0 linux/arm64 go1.27.1" data=/var/lib/postern listen=127.0.0.1:8080
time=2026-12-05T16:33:52.590+01:00 level=INFO msg=listening addr=127.0.0.1:8080
```

The `json` format writes the same as one JSON object per line (`{"time":"...","level":"INFO","msg":"starting",...}`),
for log collectors such as Loki, Vector or Elasticsearch. The desktop app always runs its built-in
Hub with `json`.

To change them:

**Docker Compose:**
`POSTERN_LOG_FORMAT` goes in `~/postern/.env`. `POSTERN_LOG_LEVEL` is not passed through by
`compose.yaml`; put it in `~/postern/compose.override.yaml`:

```yaml
services:
  hub:
    environment:
      POSTERN_LOG_LEVEL: debug
```

```sh
cd ~/postern
docker compose up -d
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
Set them in `/etc/postern/hub.env`:

```ini
POSTERN_LOG_LEVEL=debug
POSTERN_LOG_FORMAT=text
```

```sh
sudo systemctl restart postern-hub
```
**Desktop app (built-in Hub):**
The app does not offer a setting for this. The built-in Hub logs at `info` in `json` format.

Set the level back to `info` when you are done with `debug`.

## What the log contains and what it does not

The Hub does not write an access log: individual requests are not logged, only requests that
fail with a server error (`request failed` with the method, the path and the error; never the
query string or the body).

Never logged:

- passwords, two-step codes, recovery codes and session tokens;
- mailbox passwords, app passwords and OAuth access or refresh tokens;
- the master key, its passphrase and the Google client secret;
- message content: subjects, bodies and attachments.

Logged, so read the log before you share it:

- internal IDs of people and mailboxes (`user=usr_...`, `mailbox=mbx_...`);
- error messages from mail providers, which can contain your mail server's name or a mailbox
  address;
- a few email addresses: the admin's address when the Hub is set up, and the old and new address
  when a Microsoft mailbox is renamed to its own address;
- the data directory, the listen address and the issuer of single sign-on;
- the **setup code** while the Hub has no account yet (`This Hub is not set up yet. Open it in a
  browser and enter the setup code ...`). Anyone who can read the log before setup can claim the
  Hub, so keep the log private until setup is done.

Failed sign-ins are not in the Hub's log. Tools such as fail2ban have nothing to read there; the
Hub limits sign-in attempts itself (see [Rate limits](https://docs.posternmail.app/admin/sign-in/#rate-limits)).

## The security log in the app

Each person has their own log of account events in **Settings → Security → Recent security
activity**. It shows the last 50 events, each with the device name, the IP address and a detail
where there is one. Failed sign-ins are highlighted. The Hub keeps a year of events per person and
deletes older ones once a day.

| Shown as | When |
|---|---|
| Signed in | A sign-in with password, passkey, single sign-on, setup, registration or pairing (the method is the detail) |
| Failed sign-in attempt | A wrong password or code, or a password sign-in on an account without a password |
| Signed out | The device signed itself out |
| Device connected | A new device was approved with a pairing code |
| Device signed out | A device was signed out from **Settings → Devices** |
| Password changed | By the person, by an admin (**reset by an administrator**) or on the server (**reset with hub admin reset-password**) |
| Two-step verification turned on / off | Including **disabled with hub admin disable-2fa** |
| Passkey added / removed | With the passkey's name |
| Mailbox added / removed | With the mailbox address |
| Settings exported | **Settings → Account → Your data → Download** |
| Mailbox sign-ins sent to one of your devices | A desktop or mobile app fetched the mailbox credentials to get mail directly |
| Account activity | Other events, such as a change of the sign-in email |

Admins do not see other people's security logs. Each person can download theirs with their data
export. The rules engine has its own log: see [Rule activity](https://docs.posternmail.app/rules/activity/).

## Useful filters

**Docker Compose:**
```sh
cd ~/postern
docker compose logs --since 24h hub | grep -E 'level=(WARN|ERROR)'
docker compose logs hub | grep 'mailbox sync failed'
docker compose logs hub | grep -E 'backup (written|failed)'
```

With `POSTERN_LOG_FORMAT=json`, `jq` can filter by field:

```sh
docker compose logs --no-log-prefix hub | jq -c 'select(.level == "ERROR")'
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
```sh
sudo journalctl -u postern-hub --since "2 hours ago" | grep 'mailbox sync failed'
sudo journalctl -u postern-hub | grep -E 'backup (written|failed)'
```

The Hub writes everything to standard error, so journald gives every line the same priority and
`journalctl -p warning` does not find the Hub's warnings. Filter on the level with `grep`:

```sh
sudo journalctl -u postern-hub --since today | grep -E 'level=(WARN|ERROR)'
```
**Desktop app (built-in Hub):**
On macOS or Linux, in a terminal:

```sh
cd ~/Library/Application\ Support/Postern/logs
grep -E '"level":"(WARN|ERROR)"' hub.log
```

On Linux the folder is `~/.config/Postern/logs`.

Messages worth knowing:

| Message | Meaning |
|---|---|
| `mailbox sync failed` | A mailbox could not sync. The Hub retries with a delay (`retry=`). The `err=` part is the provider's answer. |
| `mailbox sync rate limited` | The provider asked the Hub to slow down. It waits and continues. |
| `scheduled backup failed` | No backup was written. Often a full disk or a backup folder the Hub cannot write to. |
| `backup written` | A scheduled backup finished, with its path and duration. |
| `oidc discovery failed`, `oidc id token rejected` | Single sign-on problems; see [Sign-in methods](https://docs.posternmail.app/admin/sign-in/#single-sign-on-oidc). |
| `legacy setting ignored: the POSTERN_ name is set too, with another value` | An old `MC_*` variable is overridden. See [Migrating from MailClient](https://docs.posternmail.app/migrating-from-mailclient/). |
| `web push unavailable` | Browser notifications could not be set up; everything else works. |
| `request failed` | A request failed with a server error. Please report it with the lines around it. |

## Log rotation

**Docker Compose:**
Docker's default `json-file` log driver does not rotate. Limit it in
`~/postern/compose.override.yaml`:

```yaml
services:
  hub:
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: "5"
```

```sh
cd ~/postern
docker compose up -d
```

Or set the same defaults for every container in `/etc/docker/daemon.json`.
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
journald rotates on its own, within the limits in `/etc/systemd/journald.conf` (`SystemMaxUse=`,
`MaxRetentionSec=`). `journalctl --disk-usage` shows how much space the journal uses. Nothing to
set up for the Hub.
**Desktop app (built-in Hub):**
When the app starts the Hub and `hub.log` is larger than 10 MB, the app renames it to
`hub.log.1` (replacing an older one) and starts a new file.

## What to include in a bug report

1. The Hub version (`postern-hub version`, or **Settings → Admin → Status → Version**) and the
   install method.
2. The output of `postern-hub doctor` ([Doctor](https://docs.posternmail.app/admin/doctor/)).
3. The log lines from a minute before the problem until a minute after it, at `info` level, or at
   `debug` if you can reproduce it.
4. What you did, what you expected and what happened instead, with the exact text of any message.

Before posting, search the text for your email addresses, mail server names, your domain and the
setup code, and replace them with placeholders such as `you@example.com` and `mail.example.com`.
Open an issue at github.com/TheOriUHD/postern/issues. Report security problems privately as
described in [Security](https://docs.posternmail.app/security/).
