Skip to content

Commit 2191b36

Browse files
committed
docs: Add log store documentation
1 parent ade74af commit 2191b36

File tree

3 files changed

+943
-0
lines changed

3 files changed

+943
-0
lines changed

README.md

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

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

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

0 commit comments

Comments
 (0)