---
title: "Use cases"
description: "What to log, how to name it, and ready-made event shapes."
canonical_url: "https://docs.logstrace.dev/guides/getting-started/use-cases"
---
# Use cases

> What to log, how to name it, and ready-made event shapes.

Every example is a [structured event](https://docs.logstrace.dev/guides/sending-logs/events#structured-events): one table per `event`, one column per key.

## Naming

<table>
<thead>
  <tr>
    <th>
      Part
    </th>
    
    <th>
      Rule
    </th>
    
    <th>
      Example
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        channel
      </code>
    </td>
    
    <td>
      Area of the system
    </td>
    
    <td>
      <code>
        auth
      </code>
      
      , <code>
        orders
      </code>
      
      , <code>
        jobs
      </code>
      
      , <code>
        admin
      </code>
      
      , <code>
        errors
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        event
      </code>
    </td>
    
    <td>
      <code>
        <area>.<past_tense_action>
      </code>
    </td>
    
    <td>
      <code>
        order.refunded
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Keys
    </td>
    
    <td>
      camelCase, same keys every time
    </td>
    
    <td>
      <code>
        orderId
      </code>
      
      , <code>
        amount
      </code>
      
      , <code>
        reason
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        level
      </code>
    </td>
    
    <td>
      <code>
        info
      </code>
      
       action · <code>
        warn
      </code>
      
       refused/suspicious · <code>
        error
      </code>
      
       server failure · <code>
        fatal
      </code>
      
       data loss
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

Send `null`, `""` or `0` instead of leaving a key out: a missing key starts a new table.

## Audit trail

Who did what to whom, filterable by any column.

```json
{ "channel": "admin", "event": "admin.user_banned", "adminId": "u_7", "targetId": "u_42", "reason": "spam", "durationMinutes": 1440 }
```

## Money and balances

Sum and average per column, spot outliers, alert on unusual volume.

```json
{ "channel": "economy", "event": "economy.balance_changed", "userId": "u_42", "amount": -250, "balance": 1750, "currency": "credits", "reason": "purchase" }
```

## Orders and purchases

```json
{ "channel": "orders", "event": "order.paid", "orderId": "10293", "userId": "u_42", "amount": 49.90, "currency": "USD", "method": "card" }
```

## Auth and security

```json
{ "channel": "auth", "event": "auth.sign_in_failed", "level": "warn", "userId": "u_42", "reason": "wrong_password", "attempt": 3 }
```

Add a [volume alert](https://docs.logstrace.dev/guides/exploring/alerts) on `auth.sign_in_failed`.

## Background jobs

Use one `traceId` per run to see every step together.

```json
[
  { "channel": "jobs", "event": "job.started", "traceId": "job-551", "jobId": "551", "kind": "invoice_export" },
  { "channel": "jobs", "event": "job.failed", "level": "error", "traceId": "job-551", "jobId": "551", "kind": "invoice_export", "attempt": 3, "durationMs": 1820,
    "data": { "stack": "Error: connect ECONNREFUSED …" } }
]
```

## API requests

```json
{ "channel": "api", "event": "http.request", "method": "POST", "route": "/checkout", "status": 402, "durationMs": 318, "userId": "u_42" }
```

Chart `durationMs` per route on a [dashboard](https://docs.logstrace.dev/guides/exploring/dashboards); alert on `level: error`.

## Errors

```json
{ "channel": "errors", "event": "errors.payment_capture_failed", "level": "error", "orderId": "10294", "gateway": "stripe", "status": 502 }
```

Long text (stack traces, responses) goes in `data`, not in a column.

## Product usage

```json
{ "channel": "product", "event": "feature.used", "userId": "u_42", "plan": "pro", "feature": "export_csv" }
```

## Realtime and multiplayer servers

Log from the server process, never from clients (the key must stay secret).

```json
{ "channel": "matches", "event": "match.ended", "matchId": "m_8812", "mode": "teams", "winner": "blue", "players": 10, "durationSeconds": 612 }
```

## Next to chat or webhook logs

Keep your existing chat or webhook notifications and send the same facts to LogsTrace as structured events. The notifications stay readable for people; LogsTrace makes them searchable, filterable and countable.

## For AI assistants

[logstrace.dev/llms.txt](https://logstrace.dev/llms.txt) summarises the ingest format, naming rules and these use cases for coding assistants that add logging to a project. Assistants can also read logs through the [MCP server](https://docs.logstrace.dev/guides/integrations/mcp).


## Sitemap

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