---
title: "Event format"
description: "Every field an event can carry."
canonical_url: "https://docs.logstrace.dev/guides/sending-logs/events"
---
# Event format

> Every field an event can carry.

An event is one log entry. Send it as JSON to `POST /api/ingest`, either as an **object with fields** (recommended) or as a **message**.

<code-group>

```json [Structured (recommended)]
{
  "channel": "payments",
  "level": "warn",
  "event": "payment.declined",
  "paymentId": "8813",
  "orderId": "10294",
  "amount": 120.00,
  "currency": "USD",
  "ts": "2026-10-06T09:12:00Z",
  "traceId": "req-7f3a9c"
}
```

```json [Message]
{
  "channel": "payments",
  "level": "warn",
  "text": "Payment 8813 for order 10294 declined 120.00 USD",
  "ts": "2026-10-06T09:12:00Z",
  "traceId": "req-7f3a9c",
  "data": { "gateway": "stripe", "attempt": 2 }
}
```

</code-group>

## Structured events

Send an object without `text`: every key that isn't one of the fields below becomes a **column with that name**. All `payment.declined` events in a channel go to one table with the columns `paymentId`, `orderId`, `amount` and `currency`, from the very first event. No guessing, no renaming.

- `event` names the table (optional, up to 100 characters of letters, digits and `- _ . :`). Events with the same name and the same keys share a table, in any key order; a new key makes a new table.
- Nested objects become dotted columns: `{ "user": { "id": "42" } }` → `user.id`. Arrays are kept as JSON in one column.
- Up to 50 fields per event, values up to 512 characters in the table. The original object is also stored in `data`, so [data filters](https://docs.logstrace.dev/guides/exploring/logs) work on it.
- The log line lists keys alphabetically: `payment.declined amount: 120 currency: USD orderId: 10294 paymentId: 8813`. Spaces inside a value show as `_` there; `data` keeps the original.
- Don't use the names below (or their aliases, like `source`, `time`, `meta`) as your own field names: they are read as the event's channel, time, and so on.
- `data` stays extra JSON next to the columns (it becomes the columns only if there are no other top-level keys).
- Extra keys on a message (`{ "text": "…", "userId": "42" }`) are added to its `data`.

## Fields

<field-group>
<field name="text" type="string">

The message, up to 16 KB. Leave it out to send a structured event.

</field>

<field name="event" type="string">

Name of a structured event, for example `order.paid`. Optional.

</field>

<field name="channel" type="string">

Any label up to 100 characters, for example `orders`. Tables are built per channel. Defaults to the `X-LogsTrace-Channel` header, else empty.

</field>

<field name="level" type="string | number">

`debug`, `info`, `warn`, `error` or `fatal`. Defaults to `info`. See [Levels](https://docs.logstrace.dev/guides/sending-logs/levels).

</field>

<field name="ts" type="string | number">

When it happened: ISO 8601, Unix seconds or Unix milliseconds. Missing, invalid, or more than 7 days away from now → the time LogsTrace received it.

</field>

<field name="data" type="object">

Your own JSON, up to 32 KB. Stored and shown with the log, masked for viewers.

</field>

<field name="traceId" type="string">

Groups events from one request or job. Up to 128 characters of letters, digits and `- _ . :`. See [Tracing](https://docs.logstrace.dev/guides/sending-logs/tracing).

</field>

<field name="spanId" type="string">

Identifies one step inside a trace. Same format as `traceId`.

</field>

<field name="embed" type="object">

Rich message: `{ title, description, fields: [{ name, value }] }` (≤25 fields). Flattened into `text`, so it is grouped into tables like any message.

</field>
</field-group>

## Field names from other loggers

You don't have to rename fields to switch to LogsTrace. These names are accepted too:

<table>
<thead>
  <tr>
    <th>
      LogsTrace
    </th>
    
    <th>
      Also accepted
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        text
      </code>
    </td>
    
    <td>
      <code>
        message
      </code>
      
      , <code>
        msg
      </code>
      
      , <code>
        body
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ts
      </code>
    </td>
    
    <td>
      <code>
        timestamp
      </code>
      
      , <code>
        time
      </code>
      
      , <code>
        @timestamp
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        channel
      </code>
    </td>
    
    <td>
      <code>
        service
      </code>
      
      , <code>
        resource
      </code>
      
      , <code>
        source
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        level
      </code>
    </td>
    
    <td>
      <code>
        severity
      </code>
      
      , <code>
        severityText
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data
      </code>
    </td>
    
    <td>
      <code>
        metadata
      </code>
      
      , <code>
        meta
      </code>
      
      , <code>
        attributes
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        traceId
      </code>
    </td>
    
    <td>
      <code>
        trace_id
      </code>
      
      , or <code>
        traceId
      </code>
      
       / <code>
        trace_id
      </code>
      
       inside <code>
        data
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        spanId
      </code>
    </td>
    
    <td>
      <code>
        span_id
      </code>
      
      , <code>
        parentId
      </code>
      
      , <code>
        parent_id
      </code>
      
      , or inside <code>
        data
      </code>
    </td>
  </tr>
</tbody>
</table>

So a typical pino, winston or OpenTelemetry-style record works as is:

```json
{ "time": 1759741920000, "level": 50, "msg": "Payment 8813 declined", "service": "payments" }
```


## Sitemap

See the full [sitemap](https://docs.logstrace.dev/sitemap.md) for all pages.
