Connections

How a server joins the journal

The visitor still reaches the application. A collector on that server reads the access log and posts a batch. Europe keeps the journal. New York does not.

Visitor

shop.example

The application answers. The collector does not stand in front of the request.

OpenResty

log_by_lua after the response

Linux daemon

tails the nginx access log

Coolify

tails the proxy log

https://dash.ledgesec.com/api/v1/observations

Europe

Caddy, the site, both cabinets, and the API. Postgres holds accounts and hosts. ClickHouse holds the journal for three years.

New York

Caddy for us.ledgesec.com only. No Postgres, no ClickHouse, no cabinet.

The batch goes to Europe. New York is a separate edge and does not store the journal.

The file every collector reads

The cabinet writes the host id and the ingest secret into this file. The examples below use placeholders.

/etc/ledgesec/agent.env

LEDGESEC_SITE_ID=host-from-the-cabinet
LEDGESEC_INGEST_SECRET=from-the-cabinet
LEDGESEC_INGEST_URL=https://dash.ledgesec.com/api/v1/observations

OpenResty

After the response, log_by_lua notes the line and a worker posts the batch. The request is not changed. Plain nginx cannot load this file. That server uses the Linux daemon instead.

env LEDGESEC_INGEST_SECRET;
env LEDGESEC_SITE_ID;

http {
    lua_package_path "/usr/local/ledgesec/lua/?.lua;;";
    lua_shared_dict ledgesec_observe 16m;

    init_worker_by_lua_block {
        require("ledgesec.observe").start()
    }

    server {
        listen 443 ssl;
        server_name shop.example;

        location / {
            log_by_lua_block {
                require("ledgesec.observe").note()
            }
            proxy_pass http://app:8080;
        }
    }
}

Linux daemon

Nginx stays as it is. The format belongs in the http block, so every server on that machine is included. A server block that already writes an access log repeats the ledgesec line. ledgesec-agent reads the file and posts the same batch.

log_format ledgesec '$msec $remote_addr $host "$request" $status $request_time';
access_log /var/log/nginx/ledgesec.log ledgesec;

Coolify

The same daemon runs on the Coolify server and follows the proxy log, including a name the proxy did not route to an application. Add these lines to the env file.

LEDGESEC_LOG=/data/coolify/proxy/access.log
LEDGESEC_EDGE_ID=eu

DNS and Apache are listed in the cabinet and cannot be added yet.