Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ This is usually only needed for developers who want to contribute to `graph-node

To build and run this project, you need to have the following installed on your system:

- Rust (latest stable): Follow [How to install
Rust](https://rust-lang.org/tools/install/). Run `rustup install
stable` in _this directory_ to make sure all required components are
installed. The `graph-node` code assumes that the latest available
`stable` compiler is used.
- Rust **1.94.0** (pinned in [`rust-toolchain.toml`](./rust-toolchain.toml)):
Follow [How to install Rust](https://rust-lang.org/tools/install/).
From this directory, `rustup show` / `cargo` will pick up the pinned
toolchain automatically. Do not use a newer `stable` until the pin is
lifted — see the comment in `rust-toolchain.toml`.
- PostgreSQL: [PostgreSQL Downloads](https://www.postgresql.org/download/) lists
downloads for almost all operating systems.
- For OSX: We highly recommend [Postgres.app](https://postgresapp.com/).
Expand Down Expand Up @@ -125,15 +125,22 @@ indexing and querying needs to be split across [multiple databases](./docs/confi
- **Disabled**: No log storage (default)

**Quick example (file-based logs for local development):**

Add a `[log_store]` section to your TOML config (passed with `--config`;
there are no `--log-store-*` CLI flags or `GRAPH_LOG_STORE_*` env vars):

```toml
[log_store]
backend = "file"
directory = "./graph-logs"
# retention_hours = 72 # optional; 0 keeps forever
```

```bash
mkdir -p ./graph-logs

cargo run -p graph-node --release -- \
--postgres-url $POSTGRES_URL \
--ethereum-rpc mainnet:archive:https://... \
--ipfs 127.0.0.1:5001 \
--log-store-backend file \
--log-store-file-dir ./graph-logs
--config ./graph-node.toml
```

Logs are queried via GraphQL at `http://localhost:8000/graphql`:
Expand Down Expand Up @@ -164,4 +171,4 @@ Copyright © 2018-2019 Graph Protocol, Inc. and contributors.

The Graph is dual-licensed under the [MIT license](LICENSE-MIT) and the [Apache License, Version 2.0](LICENSE-APACHE).

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for the specific language governing permissions and limitations under the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for the specific language governing permissions and limitations under the License.
62 changes: 18 additions & 44 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,52 +318,26 @@ those.

## Log Store Configuration

`graph-node` supports storing and querying subgraph logs through multiple backends: Elasticsearch, Loki, local files, or disabled.
`graph-node` supports storing and querying subgraph logs through multiple backends
(File, Elasticsearch, Loki, or disabled). **Log store settings are not controlled
by environment variables.**

**For complete log store documentation**, including detailed configuration, querying examples, and choosing the right backend, see the **[Log Store Guide](log-store.md)**.
Configure them under a `[log_store]` section in the TOML config file passed with
`--config` (or `GRAPH_NODE_CONFIG`). Example for local file-based logs:

### Quick Reference

**Backend selection:**
- `GRAPH_LOG_STORE_BACKEND`: `disabled` (default), `elasticsearch`, `loki`, or `file`

**Elasticsearch:**
- `GRAPH_LOG_STORE_ELASTICSEARCH_URL`: Elasticsearch endpoint URL (required)
- `GRAPH_LOG_STORE_ELASTICSEARCH_USER`: Username (optional)
- `GRAPH_LOG_STORE_ELASTICSEARCH_PASSWORD`: Password (optional)
- `GRAPH_LOG_STORE_ELASTICSEARCH_INDEX`: Index name (default: `subgraph`)

**Loki:**
- `GRAPH_LOG_STORE_LOKI_URL`: Loki endpoint URL (required)
- `GRAPH_LOG_STORE_LOKI_TENANT_ID`: Tenant ID (optional)

**File-based:**
- `GRAPH_LOG_STORE_FILE_DIR`: Log directory (required)
- `GRAPH_LOG_STORE_FILE_MAX_SIZE`: Max file size in bytes (default: 104857600 = 100MB)
- `GRAPH_LOG_STORE_FILE_RETENTION_DAYS`: Retention period (default: 30)

**Deprecated variables** (will be removed in future versions):
- `GRAPH_ELASTICSEARCH_URL` → use `GRAPH_LOG_STORE_ELASTICSEARCH_URL`
- `GRAPH_ELASTICSEARCH_USER` → use `GRAPH_LOG_STORE_ELASTICSEARCH_USER`
- `GRAPH_ELASTICSEARCH_PASSWORD` → use `GRAPH_LOG_STORE_ELASTICSEARCH_PASSWORD`
- `GRAPH_ELASTIC_SEARCH_INDEX` → use `GRAPH_LOG_STORE_ELASTICSEARCH_INDEX`

### Example: File-based Logs for Local Development
```toml
[log_store]
backend = "file"
directory = "./graph-logs"
# retention_hours = 72 # optional; 0 keeps forever
```

```bash
mkdir -p ./graph-logs
export GRAPH_LOG_STORE_BACKEND=file
export GRAPH_LOG_STORE_FILE_DIR=./graph-logs
Omit `[log_store]` (or set `backend = "disabled"`) to keep the default: logs still
go to stdout/stderr, but are not stored for `_logs` GraphQL queries.

graph-node \
--postgres-url postgresql://graph:pass@localhost/graph-node \
--ethereum-rpc mainnet:https://... \
--ipfs 127.0.0.1:5001
```
The old `--elasticsearch-*` CLI flags and `ELASTICSEARCH_*` /
`GRAPH_ELASTICSEARCH_*` environment variables were removed in favor of
`[log_store]` ([#6278](https://github.com/graphprotocol/graph-node/pull/6278)).

See the **[Log Store Guide](log-store.md)** for:
- Detailed configuration for all backends
- How log stores work internally
- GraphQL query examples
- Choosing the right backend for your use case
- Best practices and troubleshooting
**For complete documentation** (backends, GraphQL examples, migration notes), see
the **[Log Store Guide](log-store.md)**.
Loading