Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Logging

The logging section configures how Auth-O-Tron outputs diagnostic and operational information. Proper logging is essential for debugging, monitoring, and auditing.

Configuration Fields

FieldTypeDefaultDescription
levelstringinfoMinimum log level to output
formatstringconsoleOutput format: “json” or “console”
service_namestringauthotronService identifier in logs
service_versionstring(from crate)Version identifier in logs

Log Levels

The level field controls which messages are emitted. Messages at the configured level and above are logged.

LevelDescription
traceVery detailed internal state information
debugInformation useful for debugging
infoGeneral operational information
warnWarning conditions that are not errors
errorError conditions

Log Formats

Console Format

The console format outputs human-readable log lines with color coding:

2024-01-15T10:30:00.123Z  INFO auth_o_tron::server: Server started on 0.0.0.0:8080

JSON Format

The JSON format outputs structured logs following OpenTelemetry conventions, aligned with the ECMWF Codex Observability guidelines. This is recommended for production deployments and integration with log aggregation systems.

JSON format includes these fields:

FieldDescription
severityTextLog level as text (INFO, ERROR, etc.)
severityNumberNumeric log level code
bodyThe log message
timestampISO 8601 timestamp
resourceResource attributes including service name and version
attributesAdditional structured attributes

Example JSON log entry:

{
  "severityText": "INFO",
  "severityNumber": 9,
  "body": "Server started",
  "timestamp": "2024-01-15T10:30:00.123Z",
  "resource": {
    "service.name": "auth-o-tron",
    "service.version": "1.2.0"
  },
  "attributes": {
    "server.host": "0.0.0.0",
    "server.port": 8080
  }
}

Event Naming

Auth-O-Tron uses structured event naming following the pattern domain.component.action. Events are grouped by domain, allowing you to filter and analyze related operations.

DomainDescription
authAuthentication flow events
providersProvider lifecycle and validation
augmentersAugmenter lifecycle and enrichment
storeToken store operations
routesHTTP route handler events
startupServer initialization events

Example Configuration

Development (console output, debug level):

logging:
  level: debug
  format: console

Production (JSON output, info level):

logging:
  level: info
  format: json
  service_name: auth-o-tron-prod
  service_version: 1.2.0

Minimal configuration:

logging:
  level: warn