skeld Get started
Browse documentation

Events

On this page

Every record names its event in event_name. The engine writes the events below by itself; an author's call writes skeld.app.message. A record is written only when its severity reaches the threshold of its category (log.thresholds; defaults boot and app at info, security at warn). Two records take no threshold: the access record, which log.access alone turns on, and skeld.log.suppressed, whose event already passed its threshold.

Request records also carry the request keys of record-format.md: skeld.request_id, the method, the route when one matched, the status, error.type on refusals and errors, and the correlation keys when they apply.

Event table

Event Category Severity When Own keys
skeld.server.listening boot info listen resolved server.address, server.port
skeld.server.closed boot info close() was called, before queued records are flushed; its counts are a snapshot, not delivery totals skeld.log.created, skeld.log.written, skeld.log.queued, skeld.log.in_flight, skeld.log.suppressed, skeld.log.dropped.queue_full, skeld.log.dropped.reserve, skeld.log.dropped.write_failed, skeld.log.dropped.sink_failed, skeld.log.dropped.shutdown
skeld.worker.started boot info a worker's start resolved none
skeld.worker.closed boot info a worker's close() was called, before queued records are flushed; its counts are a snapshot, not delivery totals the same counts as skeld.server.closed
skeld.config.public_origin boot warn the first cross-site refusal with reason unverifiable on a server without publicOrigin; once per server none; no request id
skeld.log.dropped boot warn the first successful write after one or more drops the same counts as skeld.server.closed, cumulative since the server or worker was created, so a lost skeld.log.dropped record loses no count
skeld.log.suppressed that of the suppressed event that of the suppressed event a suppression window that refused records expires, or close() is called skeld.suppressed.event_name, skeld.suppressed.count, http.route
skeld.request.error app error the engine wrote a 5xx error body (the fixed 500 fallback included), or destroyed an unfinished response whose head was already sent; "wrote" says nothing of a client receiving it skeld.reason: thrown, http_error, timeout, undeclared_status, response_mismatch, reserved_header, invalid_cookie, redirect_refused, send_status, headers_sent, gate; the exception keys for thrown and http_error only; skeld.schema_location for response_mismatch when the mismatch has a location, skeld.returned_status for undeclared_status when the status is an integer from 100 to 999, skeld.redirect_refusal for redirect_refused, skeld.reserved_header for reserved_header
skeld.hook.error app error an observer failed and the response is unchanged skeld.reason: on_response, on_error, late_send, after_response, internal; the exception keys for every reason but late_send
skeld.refuse.framing security warn the engine refused the request, status 400 skeld.reason: duplicate-host, duplicate-authorization, duplicate-content-type or transfer-encoding
skeld.refuse.path security warn the engine refused the request, status 400 none
skeld.refuse.param_too_long security warn the engine refused the request, status 414 none
skeld.refuse.body_limit security warn the engine refused the request, status 413 none
skeld.refuse.body_depth security warn the engine refused the request, status 400 none
skeld.refuse.forbidden_key security warn the engine refused the request, status 400 none
skeld.refuse.csrf security warn the engine refused the request, status 403 skeld.reason: origin, unverifiable, fetch-site or missing
skeld.refuse.preflight security warn the engine refused the request, status 403 none
skeld.refuse.validation security info the engine refused the request, status 400 none
skeld.refuse.not_found security info the engine refused the request, status 404 none
skeld.refuse.media_type security info the engine refused the request, status 415 none
skeld.refuse.body_json security info the engine refused the request, status 400 none
skeld.refuse.credential_missing security info the gate refused the request, status 401: no credential on a policy route none
skeld.refuse.credential_invalid security warn the gate refused the request, status 401: a credential it did not accept none
skeld.refuse.credential_conflict security warn the gate refused the request, status 400: more than one credential none
skeld.refuse.csrf_token security warn the gate refused the request, status 403: a session request without its CSRF token none
skeld.refuse.rate_limited security warn the gate refused the request, status 429 none
skeld.refuse.access_denied security warn the gate refused the request, status 403 none
skeld.refuse.access_hidden security warn the gate refused the request, status 404: hidden by the policy none
skeld.refuse.resource_missing security info the gate refused the request, status 404: the policy loaded nothing none
skeld.refuse.unavailable security error the gate refused the request, status 503 none
skeld.request.closed access info the response closed, with log.access on skeld.outcome, skeld.duration_ms
skeld.app.message app the method called an author's log call message, fields

The info refusals are not written at the default security threshold of warn.

The nine skeld.refuse.<reason> events after skeld.refuse.body_json are written only on a server with a gate; the auth reference gives each reason's case and body. A gate also registers events of its own at boot, in category security, with its fields under fields: @skeld/auth registers ten, listed in its security events.

Reasons

Event Reason Means
skeld.refuse.framing duplicate-host the request carried more than one Host header
skeld.refuse.framing duplicate-authorization the request carried more than one Authorization header
skeld.refuse.framing duplicate-content-type the request carried more than one Content-Type header, refused whether or not it has a body
skeld.refuse.framing transfer-encoding the request's Transfer-Encoding was anything but exactly chunked
skeld.request.error thrown application code threw a value that is not an HttpError
skeld.request.error http_error application code threw an HttpError with a 5xx status
skeld.request.error timeout the request passed its handler time limit
skeld.request.error undeclared_status the handler returned a status its route does not declare, recorded with skeld.returned_status when it is an integer from 100 to 999
skeld.request.error response_mismatch a response body did not match its schema, recorded with skeld.schema_location, the place in the declaration where it missed (never a value); or an error handler returned a value that is not an error body, recorded without it
skeld.request.error reserved_header application code named a response header the engine owns, recorded with skeld.reserved_header, skeld's lower-case name for it
skeld.request.error invalid_cookie a cookie to set was invalid
skeld.request.error redirect_refused a 3xx Location failed the redirect check, recorded with skeld.redirect_refusal, the check's cause (never the target)
skeld.request.error send_status a hook's send named a status outside the range a contract can declare
skeld.request.error headers_sent a failure after the head was sent forced the engine to destroy the unfinished response
skeld.request.error gate a gate step threw or rejected, or answered an outcome the engine does not accept; the response is the fixed 500 and the record carries no text of the thrown value
skeld.hook.error on_response an onResponse hook threw or rejected
skeld.hook.error on_error an onError hook threw or rejected
skeld.hook.error late_send a hook called send after the response was already decided; the call throws and nothing of it is read
skeld.hook.error after_response application code threw after the response was sent; no second response is made
skeld.hook.error internal the engine failed while handling the outcome of an application callback; the response is left as it was; no application code or request produces it; it marks a fault in the engine itself

A failure keeps the reason the engine fixed when it entered the error path, whatever an error handler turns the value into: a thrown Error that an error handler answers as a 503 is recorded with reason thrown and status 503.

after_response and headers_sent are distinct: the first leaves a sent response as it was, the second ends one that was still being written. thrown and http_error are the only skeld.request.error reasons that read the error, and only when the response written is a 5xx: a 4xx the application throws writes no record.

Statuses

A refusal record's http.response.status_code is the status of the engine's refusal. When an error handler changes the response afterwards, the access record carries what was sent.

No record is written for a 4xx the application throws, for the connection teardown after a refusal, or for a forced close.

Suppression

Each of skeld.request.error, skeld.hook.error and every skeld.refuse.* event is counted per route, and once more for requests with no route. A key writes at most 20 records in a fixed 10-second window opened by its first record. The records past 20 are not created; when the window expires, with or without a further request, one skeld.log.suppressed record gives their count. Pending counts are written during close().

Suppression is decided before the error reader runs, so a suppressed record reads nothing of the error. Author records and access records are never suppressed: an author's call that carries errors reads them on every call.

Every covered failing response carries a request ID. When its error record is emitted, that record carries the same ID; suppression or delivery failure can leave no searchable record.

Lifecycle points

The engine offers its records at five points of a request. Each point counts in the diagnostic recorder under the name given, then offers its record to the logger, before any threshold is tested. They are internal: nothing subscribes to them.

Point Fires Coverage
point.start the first step of every 'request' event the engine answers: mints the request id, which every response head then carries as x-request-id, and starts the clock every request the engine answers; not a request Node's own parser answers, nor one discarded behind a refused pipelined request
point.routed a route is found absent for framing, path and not-found refusals
point.refused each refusal, before its response refusals before routing, preflight, cross-site (before any hook), body and validation
point.failed the error path is entered for a failure, a timeout or an observer failure, a hook or error handler failing after a refusal included; never for a refusal the engine made the timeout included, which skips onError
point.closed the response's 'close', once every point.start: hook replies, refusals, timeouts and both kinds of abort