Logging

Configure, collect, and interpret structured logs from the pdfRest API Toolkit Container.

Logging for container deployments

The pdfRest API Toolkit Container emits structured JSON logs to standard output by default. Collect this output with your container platform's normal logging integration, then use the shared requestId UUID to find every record produced for one request.

Use the structured log reference when configuring a log processor, alert, or dashboard.

Request correlation ID

Each incoming request receives a UUID correlation ID. The same value appears as requestId in every request-scoped application and HTTP access record. Filter or group records by this field to trace one request from receipt through its final response. Operational records are not associated with a request and do not have a Correlation ID.

Formats and levels

LOG_TYPE
string
Selects the output format. Use json for log ingestion and querying. Set text only when a human-readable compatibility format is required; text logs do not retain the complete structured record.
LOG_LEVEL
string
Sets the application-log threshold. Valid levels are error, warn, info, http, verbose, debug, and silly.
HTTP_LOG_LEVEL
string
Sets the HTTP access-log threshold independently from application logs. It accepts the same levels as LOG_LEVEL.

Container images limit runtime verbosity to verbose. Requests for debug or silly therefore do not enable those levels in a container deployment.

Standard output and file logs

Standard output remains enabled in every configuration. File logging adds rotating files; it does not replace standard output.

LOG_FILE_ENABLED
boolean
Set to true, yes, y, or 1 to also write application and HTTP access logs to files.
LOG_FILE_DIR
string
An existing, writable absolute directory. Mount this directory to retain files after a container is removed.
LOG_FILE_APP_NAME
string
File name for application logs. Use a name only, not a path.
LOG_FILE_HTTP_NAME
string
File name for HTTP access logs. Set it equal to LOG_FILE_APP_NAME to use one combined rotating file.
LOG_FILE_MAX_SIZE
integer
Maximum file size in bytes before rotation.
LOG_FILE_MAX_FILES
integer
Number of rotated files retained for each configured file name.

Docker Compose

The default configuration needs no logging-specific environment variables:

services:
  pdfrest:
    image: pdfrest/pdf-api-toolkit:latest
    environment:
      - LICENSE_KEY=${LICENSE_KEY}

To retain additional rotating files, mount a host or managed volume at /logs:

services:
  pdfrest:
    image: pdfrest/pdf-api-toolkit:latest
    environment:
      - LICENSE_KEY=${LICENSE_KEY}
      - LOG_FILE_ENABLED=true
      - LOG_FILE_DIR=/logs
      - LOG_FILE_APP_NAME=server.log
      - LOG_FILE_HTTP_NAME=http-access.log
      - LOG_FILE_MAX_SIZE=10485760
      - LOG_FILE_MAX_FILES=5
    volumes:
      - pdfrest-logs:/logs

volumes:
  pdfrest-logs:

Kubernetes

Collect standard output with your cluster logging agent. When file retention is also required, mount an organization-managed persistent volume at /logs:

containers:
  - name: pdfrest
    image: pdfrest/pdf-api-toolkit:latest
    env:
      - name: LOG_FILE_ENABLED
        value: "true"
      - name: LOG_FILE_DIR
        value: /logs
    volumeMounts:
      - name: logs
        mountPath: /logs
volumes:
  - name: logs
    persistentVolumeClaim:
      claimName: pdfrest-logs

Sanitization

LOG_SANITIZATION controls protection applied at the log-output boundary. It accepts full, partial, and off, and defaults to partial.

ModeBehavior
fullMasks recognized secrets and omits or summarizes content.
partialRetains the first four characters of eligible identifiers, fully masks passwords, and summarizes content.
offAllows deliberately requested diagnostic detail.

Each unset override inherits LOG_SANITIZATION and accepts the same values:

Environment variableApplies to
LOG_SANITIZATION_PASSWORD_FIELDSPassword fields
LOG_SANITIZATION_API_KEYS_AND_IDENTIFIERSAPI keys and similar identifiers
LOG_SANITIZATION_REQUEST_FILE_FORM_CONTENTRequest, file, and form content
LOG_SANITIZATION_DOCUMENT_AND_AI_CONTENTDocument-derived and AI content
LOG_SANITIZATION_PROCESS_ARGUMENTS_AND_OUTPUTProcess arguments and output
LOG_SANITIZATION_HTTP_QUERY_VALUESHTTP query values
LOG_SANITIZATION=off or an override set to off can expose sensitive information. Use it only for time-limited diagnostics with appropriate access controls and retention practices.

Record shape options

LOG_AUDIT_NON_APPLICABLE_FIELDS controls fields that genuinely do not apply to a record. The default omit leaves them out; null emits them as JSON null. This setting does not change applicable data that cannot be resolved. Such values use explicit markers such as unknown or anonymous.

Troubleshooting

  • An invalid log level, format, sanitization mode, file name, or file directory prevents the container from starting. Correct the value and restart it.
  • Use your platform's container-log viewer for standard output. For mounted file logs, inspect the mounted volume from the host or storage service.
  • Filter application and HTTP records on the same requestId UUID to trace one request across its lifecycle.

Structured log reference

Structured log format

With LOG_TYPE=json, the container emits JSON Lines: each log line is one JSON object. Configure ingestion systems to parse each line as JSON, then use eventType, requestId, status, outcome, and event-specific metadata for searches and alerts. Do not parse the optional human-readable message field.

Common fields

FieldTypeMeaning
eventTypestringStable machine-readable event identifier.
requestIdstringUUID shared by request-scoped records.
actorstringSanitized request identity, anonymous, or system.
sourceIpstringRequest source address, or unknown when unavailable.
serverNamestringName of the container host.
serverIpstringContainer host address, or unknown when unavailable.
routestringAPI route or path without query values in sanitized modes.
methodstringHTTP method for request-scoped records.
statusstring or numberEvent state or HTTP response status.
outcomestringNormalized success, failure, pending, or unknown.
durationMsnumberElapsed milliseconds when applicable.
errorClassstringSafe error category when applicable.
messagestringOptional safe, human-readable context.
levelstringLog severity.
timestampstringUTC ISO 8601 timestamp added when the record is emitted.

Request-scoped events carry a UUID requestId. Operational events are not tied to a request, so request-only fields are omitted by default or emitted as null when LOG_AUDIT_NON_APPLICABLE_FIELDS=null. A missing applicable value is not the same as a non-applicable field; it uses an explicit marker such as unknown or anonymous.

Examples

Successful request lifecycle event

{
  "level": "info",
  "eventType": "request.finish",
  "requestId": "0950b9bd-f046-4d3f-8ea3-d2894f1ae839",
  "actor": "anonymous",
  "sourceIp": "198.51.100.10",
  "serverName": "pdfrest-container",
  "serverIp": "192.0.2.20",
  "route": "/pdf-info",
  "method": "POST",
  "status": "succeeded",
  "outcome": "success",
  "durationMs": 47,
  "responseCode": 200,
  "timestamp": "2026-08-20T20:00:00.000Z"
}

Failed request lifecycle event

{
  "level": "error",
  "eventType": "request.finish",
  "requestId": "0950b9bd-f046-4d3f-8ea3-d2894f1ae839",
  "actor": "anonymous",
  "sourceIp": "198.51.100.10",
  "serverName": "pdfrest-container",
  "serverIp": "192.0.2.20",
  "route": "/pdf-info",
  "method": "POST",
  "status": "failed",
  "outcome": "failure",
  "durationMs": 12,
  "errorClass": "client_error",
  "responseCode": 400,
  "timestamp": "2026-08-20T20:00:01.000Z"
}

HTTP access event

{
  "level": "info",
  "message": "POST /pdf-info 200 42 - 0950b9bd-f046-4d3f-8ea3-d2894f1ae839 47.123 ms",
  "eventType": "http.request",
  "requestId": "0950b9bd-f046-4d3f-8ea3-d2894f1ae839",
  "actor": "anonymous",
  "sourceIp": "198.51.100.10",
  "serverName": "pdfrest-container",
  "serverIp": "192.0.2.20",
  "route": "/pdf-info",
  "method": "POST",
  "status": 200,
  "outcome": "success",
  "durationMs": 47.123,
  "responseSizeBytes": 42,
  "timestamp": "2026-08-20T20:00:00.000Z"
}

Operational event

{
  "level": "info",
  "eventType": "server.listen",
  "actor": "system",
  "serverName": "pdfrest-container",
  "serverIp": "192.0.2.20",
  "status": "started",
  "outcome": "pending",
  "port": 3000,
  "timestamp": "2026-08-20T19:59:55.000Z"
}

Event types

eventType is a stable, lowercase dotted identifier. The following families cover common Container events:

FamilyRepresentative event types
Request lifecyclerequest.start, request.finish
Request attributes and checksrequest.set_origin, request.set_option, request.authenticate, request.license_check
Response statusresponse_status.create, response_status.finish
Files and cleanupfile.create, file.schedule_cleanup, file.delete, file.fail_deletion
HTTP accesshttp.request
Service and processserver.listen, process.signal, process.unhandled_rejection, process.uncaught_exception
Logging safeguardsrequest.event_missing_id, event.log_failed, request.id_generation_failed

Event-specific metadata appears beside the common fields. For example, access records can include responseCode and responseSizeBytes; service events can include port. Consumers should preserve unrecognized top-level metadata so new event types remain useful without requiring a parser change.

Outcomes, errors, and sanitization

status preserves the event producer's state. outcome provides a small, consistent result vocabulary:

ConditionOutcome
HTTP 200–399 or a successful lifecycle statussuccess
HTTP 400–599 or a failed lifecycle statusfailure
A started or waiting lifecycle statepending
Missing or unrecognized stateunknown

errorClass categorizes failures without requiring consumers to parse error text. Sanitization applies before JSON or text output: query values are removed in sanitized modes, secrets are masked, and customer content is summarized or omitted according to the configured policy. The timestamp is always emitted in UTC.