> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.sqd.dev/feedback

```json
{
  "path": "/en/sdk/squid-sdk/solana-indexing/sdk/solana-batch/logs",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Log messages

> Subscribe to Solana program log messages with addLog() in Squid SDK — filter by program ID and message content for efficient log-based indexing.

#### `addLog(options)`

Get log messages emitted by some *or all* programs in the network. `options` has the following structure:

```typescript theme={"system"}
{
  // data requests
  where?: {
    programId?: string[]
    kind?: ('log' | 'data' | 'other')[]
  }

  // related data retrieval
  include?: {
    transaction?: boolean
    instruction?: boolean
  }

  range?: {
    from: number,
    to?: number
  }
}
```

Data requests:

* `programId`: the set of addresses of programs emitting the logs. Leave it undefined to subscribe to logs from all programs in the network.
* `kind`: the set of values of `kind`.

With `transaction = true` the processor will retrieve all parent transactions and add them to the `transactions` iterable within the [block data](/en/sdk/squid-sdk/solana-indexing/sdk/solana-batch/context-interfaces). You can also call `augmentBlock()` from `@subsquid/solana-objects` on the block data to populate the convenience reference fields like `log.transaction`.

Note that logs can also be requested by the other `SolanaDataSource` methods as related data.

Selection of the exact fields to be retrieved for each log and its optional parent transaction is done with the `setFields()` method documented on the [Field selection](/en/sdk/squid-sdk/solana-indexing/sdk/solana-batch/field-selection) page.

## Examples

Fetch all event logs emitted by Orca Whirlpool.

```ts theme={"system"}
const dataSource = new DataSourceBuilder()
  .setGateway('https://v2.archive.subsquid.io/network/solana-mainnet')
  .addLog({
    where: {
      programId: [PYTH_PUSH_ORACLE_PROGRAM_ID]
    },
    include: {
      instruction: true
    },
    range: {
      from: 241_000_000
    }
  })
  .build()
```
