Skip to main content
Structured logging captures log data as key-value fields rather than plain text strings. Instead of embedding information in a message like "User 123 placed order for $99.99", structured logging stores each piece of data separately — making logs searchable, filterable, and machine-readable.

Why Structured Logging?

Plain text logs are easy to write but hard to work with at scale:
Finding all orders over $50, or all errors for a specific user, requires fragile text parsing. Structured logs solve this by storing data as discrete fields:
Now you can filter by userId, search by level, aggregate by amount, and alert on tags — without parsing text.

Key Fields

Every Timberlogs entry has a standard set of fields: Additional optional fields include userId, sessionId, requestId, flowId, and stepIndex for correlation.

Structured Data Enables Analysis

With structured fields, you can:
  • Filter logs by level, source, environment, or tags
  • Search within the data object for specific values
  • Correlate related events using requestId, sessionId, or flowId
  • Aggregate numeric fields for performance analysis
  • Alert on specific tag or level combinations

Datasets

Datasets let you group and route logs by purpose. Set a dataset field on any log to organize logs into logical collections — for example, separating billing logs from auth logs. This is useful for access control, retention policies, and focused analysis.

Further Reading

  • Log Levels — severity hierarchy and when to use each level
  • Flows — grouping related logs across multi-step operations
  • SDK Logging Methods: TypeScript | Python — how to send structured logs from your application