eth_getFilterLogs
JSON-RPC method returns an array of all logs matching the filter with the given ID. Unlike eth_getFilterChanges
, this method returns all matching logs from the entire filter range, not just changes since the last poll. This method is useful for retrieving the complete history of events matching a filter.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
- filter_id (string) — The filter ID returned by
eth_newFilter
(not compatible with block filters created byeth_newBlockFilter
)
Response
The method returns an array of log objects matching the filter criteria from the entire filter range.Response structure
Log objects contain:address
— The address from which this log originatedtopics
— Array of 0 to 4 indexed log arguments (32-byte hex strings)data
— Contains non-indexed arguments of the logblockNumber
— The block number where this log was in (hex string)transactionHash
— Hash of the transaction this log was created fromtransactionIndex
— Integer of the transaction index position log was created fromblockHash
— Hash of the block where this log was inlogIndex
— Integer of the log index position in the blockremoved
— True when the log was removed due to a chain reorganization
Difference from eth_getFilterChanges
Complete vs incremental:eth_getFilterLogs
: Returns ALL logs matching the filter criteriaeth_getFilterChanges
: Returns only NEW logs since the last poll
- Use
eth_getFilterLogs
for complete historical analysis - Use
eth_getFilterChanges
for real-time monitoring
Usage example
Basic implementation
Example request
Shell
Use cases
Theeth_getFilterLogs
method is useful for applications that need to:
- Historical analysis: Analyze complete event history for a specific filter
- Data export: Export all matching logs for external analysis
- Compliance reporting: Generate complete reports of contract activities
- Audit trails: Create comprehensive audit trails for specific events
- Research tools: Support blockchain research with complete event datasets
- Analytics platforms: Perform comprehensive analytics on event data
- Backup and archival: Create backups of event data for specific filters
- Data migration: Migrate event data between systems
- Forensic analysis: Investigate blockchain activities with complete event logs
- Statistical analysis: Generate statistics from complete event datasets
- Reconciliation: Reconcile event data with external systems
- Event replay: Replay complete sequences of events for testing
- Data validation: Validate event data integrity and completeness
- Batch processing: Process large batches of events efficiently
- Report generation: Generate comprehensive reports from event data
Body
application/json