Skip to content

Standardize JSONL log record format: consistent timestamp and event fields #3787

Closed

Description

@lpcox

Problem

AWF produces 5 JSONL log files across its containers, but their record formats are inconsistent. This makes cross-log correlation, aggregation, and tooling harder than necessary.

Current State

File Timestamp field Format Event/Type field Discriminator
audit.jsonl (Squid) ts Unix epoch float ❌ None decision + method
token-usage.jsonl (API proxy) timestamp ISO 8601 ❌ None _schema only
token-diag.jsonl (API proxy) timestamp ISO 8601 ✅ event e.g. MODEL_ALIAS_RESOLUTION_STEP
otel.jsonl (API proxy) timestamp ISO 8601 ❌ None name (span name)
access.jsonl (CLI proxy) ts ISO 8601 ✅ event e.g. exec_start, exec_done
API proxy stdout timestamp ISO 8601 ✅ event e.g. model_resolution

Issues

  1. Inconsistent timestamp field name: ts vs timestamp — cannot write a single query/parser that works across all logs
  2. Inconsistent timestamp format: Squid uses Unix epoch float (1716000000.123), everything else uses ISO 8601 (2026-05-25T09:00:00.000Z)
  3. Missing event/type discriminator: audit.jsonl, token-usage.jsonl, and otel.jsonl have no top-level event or type field to identify the record kind
  4. Not specified in schemas: The required fields and their formats are not formally defined in the config spec or JSON Schemas

Proposed Standard

All AWF JSONL records MUST include:

{
  "timestamp": "<ISO 8601 with milliseconds>",
  "event": "<unique_event_type_string>",
  "_schema": "<record-type>/v<version>",
  ...
}

Rules

  1. timestamp (string, required): ISO 8601 format with milliseconds (YYYY-MM-DDTHH:mm:ss.SSSZ). Use timestamp as the field name everywhere.
  2. event (string, required): A unique, stable identifier for the record type. Must be snake_case. Examples: http_access_allowed, http_access_denied, token_usage, otel_span, cli_exec_start.
  3. _schema (string, required): Schema version identifier (already present on some records).

Migration Plan

File Change
audit.jsonl Rename ts → timestamp, convert to ISO 8601, add event field (http_access_allowed / http_access_denied based on decision)
token-usage.jsonl Add event: "token_usage" field
otel.jsonl Add event: "otel_span" field
access.jsonl (cli-proxy) Rename ts → timestamp
API proxy stdout Already conformant ✅
token-diag.jsonl Already conformant ✅

Schema Updates

  • Update schemas/audit.schema.json to require timestamp (ISO 8601) and event
  • Update schemas/token-usage.schema.json to require event
  • Add schemas/otel-span.schema.json (or document the format)
  • Add schemas/cli-proxy-access.schema.json (or document the format)
  • Document the standard fields in docs/awf-config-spec.md §13 (Log File Inventory) as a normative requirement

Breaking Change Considerations

  • audit.jsonl: Renaming ts → timestamp and switching from epoch → ISO 8601 is a breaking change for downstream consumers (e.g. awf logs stats parser)
  • access.jsonl: Renaming ts → timestamp affects any CLI proxy log consumers
  • Both require a schema version bump and migration period (emit both old and new field names temporarily, or bump schema version and let consumers check _schema)

Affected Files

  • src/squid/config-generator.ts — Squid audit_jsonl logformat string
  • containers/api-proxy/token-persistence.js — buildTokenUsageRecord()
  • containers/api-proxy/otel.js — FileExporter.export()
  • containers/cli-proxy/server.js — accessLog()
  • src/logs/log-aggregator.ts — Parser for audit.jsonl (will need to handle both formats during migration)
  • schemas/audit.schema.json — Add event field, change ts to timestamp
  • schemas/token-usage.schema.json — Add event field
  • docs/awf-config-spec.md §13 — Document normative field requirements

Activity

  1. added
    enhancement
    on May 25, 2026
  2. github-actions commented on May 25, 2026

    @github-actions
    Contributor

    👋 Hello! I checked for potential duplicates and found a related issue (not a duplicate):

    While both issues discuss JSONL log formats and schemas, they address different concerns:

    This issue appears to be a valid follow-up that builds on the schema work from #2378, identifying concrete format standardization needs. The two issues complement each other rather than duplicate.

    This is an automated message from the issue duplication detector.

    Note

    🔒 Integrity filter blocked 6 items

    The following items were blocked because they don't meet the GitHub integrity level.

    To allow these resources, lower min-integrity in your GitHub frontmatter:

    tools:
      github:
        min-integrity: approved  # merged | approved | unapproved | none

    Generated by Issue Duplication Detector for issue #3787 · ● 3.1M · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions