logsSubscribe — Solana WebSocket Method
logsSubscribe streams transaction log messages in real time. Logs include program invocations, error messages, and custom msg!() / sol_log output from programs.
Subscribe request
Subscribe to all non-vote transaction logs:
{
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": ["all"]
}
Filter to logs mentioning a specific program:
{
"jsonrpc": "2.0",
"id": 1,
"method": "logsSubscribe",
"params": [
{"mentions": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"]},
{"commitment": "confirmed"}
]
}
Notification format
{
"jsonrpc": "2.0",
"method": "logsNotification",
"params": {
"result": {
"context": { "slot": 123456789 },
"value": {
"signature": "5VERvPixYNsarPMsVExFPzcSD...",
"err": null,
"logs": [
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
"Program log: Instruction: Transfer",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 200000 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
]
}
},
"subscription": 42
}
}
Use cases
| Use case | Filter |
|---|---|
| Monitor all DEX activity | {"mentions": ["<jupiter_program_id>"]} |
| Track program errors | "all" + filter err !== null client-side |
| Debug your program | {"mentions": ["<your_program_id>"]} |
| Watch all network activity | "allWithVotes" (very high volume) |
FAQ
What is the difference between “all” and “allWithVotes”?
"all" excludes vote transactions, which constitute the majority of Solana transactions. "allWithVotes" includes everything. For most use cases, "all" is sufficient and generates far less traffic.
Can I filter by multiple programs?
The mentions array accepts only one pubkey. To monitor multiple programs, create separate subscriptions for each.
Do logs include the full transaction data? No. Logs include only the signature, error status, and log messages. To get full transaction data, use the signature with getTransaction.
Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
filter | string | object | Yes | "all" for all transactions (excludes vote transactions), "allWithVotes" includes votes, or {"mentions": ["<pubkey>"]} to filter by account | — |
config | object | No | Configuration object with commitment | — |
Updated: