# Logs configuration

## Evlog options

Logs are part of `observability` in `vitehub()`. Pass native Evlog options under `observability.evlog`:

```ts fragment
observability: {
  logs: true,
  evlog: {
    env: { service: 'checkout' },
    redact: { paths: ['customer.email'] },
    exclude: ['/_vitehub/**', '/api/_vitehub/**'],
  },
}
```

Read the [Evlog documentation](https://evlog.dev) for its options and drains. If your app already registers the Evlog Nitro module, keep its options there. ViteHub reuses it.

## Read an existing backend

Set `observability.logs.source` to a server module that exports a `LogSource` as its default export:

```ts fragment
observability: { logs: { source: './server/logs.ts' } }
```

The module implements the [Server API](https://vitehub.dev/docs/logs/server-api) read contract. Query your backend with server credentials, normalize events, and return the newest first. List only filters the backend can apply. Pass the abort signal to backend requests.

Source mode starts no logger, drain, or local buffer, unless `observability.service` turns on Agent telemetry, which registers Evlog. Your setup keeps sending events. The source only reads them.

Evlog can export to PostHog, OTLP, and other destinations, but those drains give the Console no history. ViteHub has no built-in PostHog or OTLP history adapter. Write a source against the destination's query API, because OTLP ingestion alone cannot answer queries.

Keep backend credentials in server config. Remove sensitive fields before you return events to the Console.

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/logs.md)
- [Get started](https://vitehub.dev/raw/docs/logs/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/logs/configure.md) (this page)
- [Server API](https://vitehub.dev/raw/docs/logs/server-api.md)
- [Hosts](https://vitehub.dev/raw/docs/logs/hosts.md)
- [Limits and errors](https://vitehub.dev/raw/docs/logs/limits-and-errors.md)

Next: [Server API](https://vitehub.dev/raw/docs/logs/server-api.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
