Skip to content

Commit 8ebc977

Browse files
committed
docs: Add log store documentation
1 parent b807aab commit 8ebc977

3 files changed

Lines changed: 943 additions & 0 deletions

File tree

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,44 @@ Very large `graph-node` instances can also be configured using a
115115
the `graph-node` needs to connect to multiple chains or if the work of
116116
indexing and querying needs to be split across [multiple databases](./docs/config.md).
117117

118+
#### Log Storage
119+
120+
`graph-node` supports storing and querying subgraph logs through multiple backends:
121+
122+
- **File**: Local JSON Lines files (recommended for local development)
123+
- **Elasticsearch**: Enterprise-grade search and analytics (for production)
124+
- **Loki**: Grafana's log aggregation system (for production)
125+
- **Disabled**: No log storage (default)
126+
127+
**Quick example (file-based logs for local development):**
128+
```bash
129+
mkdir -p ./graph-logs
130+
131+
cargo run -p graph-node --release -- \
132+
--postgres-url $POSTGRES_URL \
133+
--ethereum-rpc mainnet:archive:https://... \
134+
--ipfs 127.0.0.1:5001 \
135+
--log-store-backend file \
136+
--log-store-file-dir ./graph-logs
137+
```
138+
139+
Logs are queried via GraphQL at `http://localhost:8000/graphql`:
140+
```graphql
141+
query {
142+
_logs(subgraphId: "QmYourSubgraphHash", level: ERROR, first: 10) {
143+
timestamp
144+
level
145+
text
146+
}
147+
}
148+
```
149+
150+
**For complete documentation**, see the **[Log Store Guide](./docs/log-store.md)**, which covers:
151+
- How to configure each backend (Elasticsearch, Loki, File)
152+
- Complete GraphQL query examples
153+
- Choosing the right backend for your use case
154+
- Performance considerations and best practices
155+
118156
## Contributing
119157

120158
Please check [CONTRIBUTING.md](CONTRIBUTING.md) for development flow and conventions we use.

docs/environment-variables.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,55 @@ those.
315315
Disabling the store call cache may significantly impact performance; the actual impact depends on
316316
the average execution time of an `eth_call` compared to the cost of a database lookup for a cached result.
317317
(default: false)
318+
319+
## Log Store Configuration
320+
321+
`graph-node` supports storing and querying subgraph logs through multiple backends: Elasticsearch, Loki, local files, or disabled.
322+
323+
**For complete log store documentation**, including detailed configuration, querying examples, and choosing the right backend, see the **[Log Store Guide](log-store.md)**.
324+
325+
### Quick Reference
326+
327+
**Backend selection:**
328+
- `GRAPH_LOG_STORE_BACKEND`: `disabled` (default), `elasticsearch`, `loki`, or `file`
329+
330+
**Elasticsearch:**
331+
- `GRAPH_LOG_STORE_ELASTICSEARCH_URL`: Elasticsearch endpoint URL (required)
332+
- `GRAPH_LOG_STORE_ELASTICSEARCH_USER`: Username (optional)
333+
- `GRAPH_LOG_STORE_ELASTICSEARCH_PASSWORD`: Password (optional)
334+
- `GRAPH_LOG_STORE_ELASTICSEARCH_INDEX`: Index name (default: `subgraph`)
335+
336+
**Loki:**
337+
- `GRAPH_LOG_STORE_LOKI_URL`: Loki endpoint URL (required)
338+
- `GRAPH_LOG_STORE_LOKI_TENANT_ID`: Tenant ID (optional)
339+
340+
**File-based:**
341+
- `GRAPH_LOG_STORE_FILE_DIR`: Log directory (required)
342+
- `GRAPH_LOG_STORE_FILE_MAX_SIZE`: Max file size in bytes (default: 104857600 = 100MB)
343+
- `GRAPH_LOG_STORE_FILE_RETENTION_DAYS`: Retention period (default: 30)
344+
345+
**Deprecated variables** (will be removed in future versions):
346+
- `GRAPH_ELASTICSEARCH_URL` → use `GRAPH_LOG_STORE_ELASTICSEARCH_URL`
347+
- `GRAPH_ELASTICSEARCH_USER` → use `GRAPH_LOG_STORE_ELASTICSEARCH_USER`
348+
- `GRAPH_ELASTICSEARCH_PASSWORD` → use `GRAPH_LOG_STORE_ELASTICSEARCH_PASSWORD`
349+
- `GRAPH_ELASTIC_SEARCH_INDEX` → use `GRAPH_LOG_STORE_ELASTICSEARCH_INDEX`
350+
351+
### Example: File-based Logs for Local Development
352+
353+
```bash
354+
mkdir -p ./graph-logs
355+
export GRAPH_LOG_STORE_BACKEND=file
356+
export GRAPH_LOG_STORE_FILE_DIR=./graph-logs
357+
358+
graph-node \
359+
--postgres-url postgresql://graph:pass@localhost/graph-node \
360+
--ethereum-rpc mainnet:https://... \
361+
--ipfs 127.0.0.1:5001
362+
```
363+
364+
See the **[Log Store Guide](log-store.md)** for:
365+
- Detailed configuration for all backends
366+
- How log stores work internally
367+
- GraphQL query examples
368+
- Choosing the right backend for your use case
369+
- Best practices and troubleshooting

0 commit comments

Comments
 (0)