Skip to main content
ONR access logs support an nginx-like format string via logging.access_log_format (or logging.access_log_format_preset).

Formatting rules

  • Variables are referenced as $name (example: $status).
  • If a variable is missing or empty, ONR prints - at that position.
  • $$ renders a literal $.

Configuration

In onr.yaml:
Rotation notes:
  • Rotation only applies when access_log_path is non-empty (file output).
  • When access_log_rotate.enabled=true, access_log_path is required.
  • Rotation triggers on either day boundary (local time) or size threshold.
  • Archive file pattern: <access_log_path>.YYYYMMDD-HHMMSS.NNNNNNNNN (or .gz when compress=true).
Rotation knobs:
  • max_size_mb: rotate when the next write would exceed this file size.
  • max_backups: keep only the newest N archives.
  • max_age_days: remove archives older than N days; 0 disables age-based cleanup.
  • compress: gzip archive files after rotation.
Daily-first setup example:
Note:
  • Current behavior is day-boundary OR size-threshold (not an exclusive mode switch).

Field reference

Request line fields Identity and routing Usage and cost Flat usage extras:
  • When usage_extract custom; uses usage_fact ... with non-legacy detail, ONR also emits flattened usage fields into the access log.
  • These keys are appended directly as normal log variables and follow a snake_case convention derived from dimension + attributes + unit.
  • Legacy scalar usage stays unchanged: input_tokens, output_tokens, total_tokens, cache_read_tokens, cache_write_tokens.
  • Typical examples:
    • $cache_write_ttl_5m_tokens
    • $cache_write_ttl_1h_tokens
    • $server_tool_web_search_calls
    • $image_generate_images
    • $image_edit_images
    • $audio_tts_seconds
    • $audio_stt_seconds
    • $audio_translate_seconds
  • For Anthropic non-stream /v1/messages, cache_write token attr.ttl="5m" and attr.ttl="1h" can therefore appear both as:
    • $cache_write_tokens
    • $cache_write_ttl_5m_tokens
    • $cache_write_ttl_1h_tokens
  • The same flattening applies to canonical image/audio/tool facts extracted by ONR or produced by API-specific OpenAI presets such as openai_responses, openai_images_generations, or openai_audio_speech, for example:
    • image.generate image
    • image.edit image
    • audio.tts second
    • audio.stt second
    • audio.translate second
  • These flattened keys are only present when the corresponding usage_fact matched or was produced with quantity 0 from an upstream response that included the field.
Upstream and streaming performance