OpenInfra.sh is now live - Solana infrastructure, included with every server. LEARN MORE HERE >

OpenInfra.shopeninfra.sh

logsSubscribe

Stream the log messages produced by every confirmed transaction, optionally filtered to a specific program.

All logs

// Subscribe to all non-vote transaction logsws.send(JSON.stringify({  jsonrpc: "2.0",  id: 1,  method: "logsSubscribe",  params: [    "all",    { commitment: "confirmed" },  ],}));

The "all" filter receives logs from every non-vote transaction. At peak this is a very high rate — filter to a program where possible.

Filter by program

// Subscribe to logs only from a specific programws.send(JSON.stringify({  jsonrpc: "2.0",  id: 1,  method: "logsSubscribe",  params: [    {      mentions: ["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"],    },    { commitment: "confirmed" },  ],})); // Notification:// {//   "method": "logsNotification",//   "params": {//     "result": {//       "context": { "slot": 312449201 },//       "value": {//         "signature": "5hEk7P...",//         "err": null,//         "logs": [//           "Program JUP6L... invoke [1]",//           "Program log: Instruction: Route",//           "Program JUP6L... success"//         ]//       }//     },//     "subscription": 99//   }// }

The mentions filter receives notifications for any transaction that invokes or is invoked by the listed program — including inner instructions.