-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
When running graph-node in containerized environments (e.g., Kubernetes, Docker) with log collectors that rely on the output stream (stdout vs. stderr) for default severity classification (such as Google Cloud Logging), all log entries, including informational (INFO) and debug (DEBG), are being routed to stderr.
This causes log collectors to incorrectly assign a high severity (typically ERROR or WARNING) to all log messages, leading to noise, inaccurate alerting, and failed correlation between the actual log level specified in the text and the ingested log severity.
Steps to Reproduce
Run graph-node (e.g., using Docker Compose).
Inspect the container's raw output file (e.g., the *-json.log file in the Docker runtime).
Observe the JSON entries, specifically the "stream" field.
The log message contains the correct severity level (e.g., INFO, DEBG) in the text payload, but the associated stream is uniformly stderr.
Example Log Snippet (from *-json.log file inspection):
{
"log": "Nov 03 13:07:22.712 INFO Done processing trigger, gas_used: 2645160084, data_source: Pool, handler: handleSwap, total_ms: 94, transaction: 0x3a66…afca, address: 0x631b…156a, signature: Swap(indexed address,indexed address,int256,int256,uint160,uint128,int24), runner_index: 3, sgd: 11, subgraph_id: QmZ48KpeVzS3Bkbh3nfG9gNoTWSbyT9UhfHkRAsrqixDYP, component: SubgraphInstanceManager\n",
"stream": "stderr",
"time": "..."
}
Another Example (DEBUG level):
"log": "Nov 03 13:07:22.991 DEBG Rotating query cache, stats for last block, avg_insert_time_ms: 0.00, fill_ratio: 0.01, dead_inserts: 1, avg_hits: 0.00, entries: 1, network: doma-testnet, shard: 110, query_id: 4550a65443f2f62c-6dc8c4ef99f8cc6a, subgraph_id: QmZ48KpeVzS3Bkbh3nfG9gNoTWSbyT9UhfHkRAsrqixDYP, component: GraphQlRunner\n",
"stream": "stderr",
"time": "..."
}
Expected Behavior
Logs generated with info! or debug! should be routed to stdout ("stream": "stdout"). Only logs generated with warn!, error!, or critical! should be routed to stderr ("stream": "stderr").
Sorry but I'm not a rust developer I couldn't figure out how to solve it. I was searching about logging but without success.