Documentation / Connect
Ingest gateway
Keep incoming errors, logs and metrics safe when the app is slow or restarting.
Your applications send errors, logs and metrics to CloseYourIt. There are two ways for that data to arrive: direct, which is what you get after the install, and through the gateway, which you turn on with one command.
The two paths
Direct (default)
your application → Caddy → app → worker → database
- Your application sends a request to
https://<your-domain>/api/…. - Caddy, the web server, hands it to the app.
- The app checks the token and answers
202. - The worker saves the data a moment later.
If the app is restarting or too busy at step 2, the request fails. The data is lost unless the sender tries again.
Through the gateway
your application → Caddy → gateway → app → worker → database
↓ app not answering
queue → app, later
- Your application sends the same request to the same address.
- Caddy hands incoming data to the gateway. Everything else under
/api/— reading data back, the Automator — still goes straight to the app. - The gateway forwards the request to the app and waits a few seconds.
- If the app answers, even with an error such as
401or422, your application gets that answer. Nothing is queued. - If the app does not answer, is overloaded (
429) or fails (5xx), the gateway stores the request, encrypted, in a queue (NATS JetStream) and answers202at once. - The gateway keeps trying to deliver what is in the queue until the app takes it.
Side by side
| Direct | Through the gateway | |
|---|---|---|
| App restarting or overloaded | the request fails | the request waits in the queue |
| Extra services | none | two: gateway and nats |
| Extra disk | none | up to 6 GB |
| Address and tokens in your applications | https://<your-domain> | the same |
When you need it
- Many applications send data, or one sends a lot.
- You update often and do not want to lose data during restarts.
For a small team with a few projects you can do without it.
Move from direct to the gateway
Nothing changes in your applications: same address, same tokens. No data is moved, and you can go back at any time.
- Check there is room:
df -h /opt/closeyouritshould show at least 6 GB free. - Turn it on:
closeyourit enable ingest - Check that
gatewayandnatsare running next toapp,worker,postgresandcaddy:closeyourit status - Send one request by hand (see the HTTP API) and check it shows up in CloseYourIt.
The switch takes a few seconds. A request that arrives in that moment may fail. Caddy moves to the gateway only once the gateway has stayed up: if it does not, the command says so, turns it off again and data keeps going straight to the app.
How to tell a request was queued
When the gateway keeps a request instead of delivering it at once, it answers 202 with the header X-CloseYourIt-Queued: true (the Sentry-compatible addresses answer 200, as those SDKs expect). That answer means "safe in the queue", not "saved in CloseYourIt yet".
What the gateway accepts
Only the addresses that receive data: events, metrics, logs, page views, replays, releases, cron check-ins, server samples and the two Sentry-compatible addresses. See the HTTP API.
Everything else under /api/ — reading data back, the Automator picking up work — keeps going straight to the app, gateway on or off.
| Limit | Value |
|---|---|
| Size of one request | 5 MB |
| Requests per minute from one IP address | 600 |
| Queue | 4 GB |
| Requests that could not be delivered | 1 GB, kept apart |
When the queue is full, new requests are refused rather than dropping the ones already waiting.
A request that keeps failing is retried with growing pauses. After 20 attempts it is moved to the "could not be delivered" store and no longer retried.
Reading data or the Automator stopped working
Early installs sent all of /api/ to the gateway, which refuses what it does not know: reading data back answers 405 and the Automator gets 404. Run closeyourit update: it also brings the web server file of the new version.
The encryption key
Requests in the queue are encrypted with the key in /opt/closeyourit/ingest/envelope_key. The queue password is in /opt/closeyourit/ingest/nats_password. Both are generated at install time. If you replace the key while requests are waiting, those requests can no longer be read.
Move back to direct
closeyourit disable ingest
Requests go back to the direct path at once. The gateway then gets 30 seconds to deliver what is still waiting, and stops. Anything not delivered by then stays in the queue on disk and is delivered the next time you turn the gateway on.
Do it while the app is healthy, so the queue is already empty.
OpenTelemetry is configured separately
The optional OTLP receiver has separate listeners, authentication and request limits. Enabling this native ingest gateway does not expose or activate those listeners automatically.