Skip to content
Logging & Monitoring

Logging & Monitoring

JSON Access Logs

log_format json_combined escape=json
  '{"time":"$time_iso8601",'
  '"remote_addr":"$remote_addr",'
  '"method":"$request_method",'
  '"uri":"$request_uri",'
  '"status":$status,'
  '"bytes_sent":$body_bytes_sent,'
  '"request_time":$request_time,'
  '"upstream_addr":"$upstream_addr",'
  '"upstream_status":"$upstream_status",'
  '"upstream_response_time":"$upstream_response_time",'
  '"cache_status":"$upstream_cache_status"}';

access_log /var/log/naati/access.log json_combined buffer=32k flush=5s;

Syslog Shipping

Ship access and error logs to a UDP syslog receiver (server=unix: is not yet supported):

error_log  syslog:server=127.0.0.1:514,facility=local7,tag=naati notice;
access_log syslog:server=127.0.0.1:514,facility=local7,tag=naati json_combined;

Connection Metrics (stub_status)

Expose live active, reading, writing, and waiting connection metrics on localhost for Prometheus exporters or health scripts:

server {
    listen 127.0.0.1:8089;

    location = /stub_status {
        stub_status;
        allow 127.0.0.1;
        deny all;
    }
}

Log Rotation

The Linux packages install /etc/logrotate.d/naati, which rotates logs daily and sends SIGUSR1 (naati -s reopen) so workers seamlessly reopen log file descriptors without restarting.