# Health, logs and monitoring

## Health checks

CrushMFT 27 answers two addresses on its web ports without a login, a cookie or a session:

| Address | Answers | Use it for |
|---|---|---|
| `/WebInterface/api/healthz` | `200 {"status":"ok"}` while the process answers | liveness: restart the container if it stops answering |
| `/WebInterface/api/readyz` | `200 {"status":"ready"}` when the server has started, its ports are up and it is not shutting down; `503 {"status":"not_ready"}` otherwise | readiness: send traffic only when ready |

```
curl -s http://localhost:8080/WebInterface/api/readyz
```

They are on by default; the setting `api_health` (`false`) turns them off, after which they answer 404. Through a proxy they are reached like any other page, so a load balancer can use them too.

### Docker

The image has no shell and no curl, so a Docker health check runs a small Java program that asks the readiness address and exits 0 (healthy) or 1:

```
docker run -d ... \
  --health-cmd "java -jar /app/container/CrushContainer.jar -health" \
  --health-interval 30s --health-timeout 15s --health-start-period 180s --health-retries 3 \
  crushftp/crushmft27:latest
```

`docker ps` then shows `(healthy)`. The program asks `http://127.0.0.1:8080/WebInterface/api/readyz`; if port 8080 is not an HTTP port of your server, give another address as an argument (`-health http://127.0.0.1:9090/WebInterface/api/readyz`) or in `CRUSHFTP_HEALTH_URL`. In Compose, see [Docker Compose](Docker-Compose.md).

The image does not declare the health check itself (the OCI image format has none), so add it as above.

### Kubernetes

The [chart](Kubernetes.md) sets a startup probe and a readiness probe on `readyz` and a liveness probe on `healthz`. The startup probe allows five minutes for a start.

## Logs

The server's log goes to the container's output, so `docker logs`, `docker compose logs` and `kubectl logs` show it, as well as any log collector reading container output:

```
docker logs -f crushmft27
```

```
SERVER|11/20/2026 15:23:57.758|...
START|11/20/2026 15:23:57.758|11/20/2026 15:23:57.758|---Server Started--- LAN IP=172.17.0.2 WAN IP=203.0.113.10 PORT=8080
```

Each line starts with its tag (`SERVER`, `START`, `UPDATE`, `GENERAL`, ...) and the time, in the container's time zone (`TZ`, [Configuration](Configuration.md#environment-variables)). The lines of the start program (`CrushContainer:`) and of CrushMFT's launcher come first ([How it works](How-It-Works.md#in-the-log)).

How this works: in a container, CrushMFT adds a **console log target** to its log targets by itself (`Log target Console (container) started` at the start). It is not saved in the settings. It is left out when you set up a console log target of your own in the logging preferences (for example in a JSON format for your log system), and you can turn it off with `-e JDK_JAVA_OPTIONS=-Dcrushmft.container.console=false`.

The log is also written as files in the volume, as on any CrushMFT server: `CrushMFT.log` in the working folder, and the session logs in `logs/session_logs/`. The logging preferences (level, rotation, Syslog, SQL, SIEM formats) work as described in the [CrushMFT 27 documentation](../CrushMFT27/Main.md).

The log level: Preferences, or the split_prefs file `_log_debug_level.txt` (`0`, `1` or `2`).

## Metrics

CrushMFT 27 can serve Prometheus metrics at `/metrics` on its web ports, with an Enterprise licence: health, ports and their connections, memory and CPU, open files, free disk, the job engine, log targets, the cluster and replication, and more (every series starts with `crushftp_`). They are off until turned on in the preferences (`prometheus_enabled`), and are given only to the addresses in `prometheus_allowed_ips` or to requests with the token `prometheus_token` (`Authorization: Bearer <token>`). For a Kubernetes cluster's Prometheus, allow the cluster's pod network or use the token, and scrape port 8080.

## Looking inside

| | Plain image | `-dev` image |
|---|---|---|
| Thread dump | `docker exec crushmft27 jcmd 1 Thread.print` | the same |
| Memory | `docker exec crushmft27 jcmd 1 GC.heap_info` | the same |
| A recording for support | `docker exec crushmft27 jcmd 1 JFR.start duration=60s filename=/app/CrushMFT27/rec.jfr` | the same |
| A shell | none | `docker exec -it crushmft27 bash` |
| Files in the volume | the `-dev` image: `docker run --rm -v crushmft27:/app/CrushMFT27 --entrypoint ls crushftp/crushmft27:latest-dev -la /app/CrushMFT27` | `docker exec crushmft27 ls -la /app/CrushMFT27` |

The server is always process 1 in the container. `docker stats crushmft27` shows its memory and CPU.
