Tezos node: Logging RPC requests and responses
We have turned on debug logging on the Tezos node using the -vv
argument. From reading the docs this seems to be the most detailed logging available. When a request comes into an RPC endpoint, the logs simply say something to the effect of:
- [timestamp] [URL] output media type application/json
- [timestamp] [URL] input media type application/json
- [timestamp] [URL] Request received
It doesn't output anything relating to the request or the response, the JSON sent/received, http status codes etc. This data is critical for production deployments to be able to debug and reproduce issues.
We've posted on several channels / sites asking for a way to log this data, with no answer. If Logging this data is an available feature, please detail how to achieve it. If this isn't available, please add it as a top priority. As our clients become more complicated and interact with more smart contracts, it will become more and more difficult to ensure stability without being able to monitor the logs.
Edit: Sample / Examples:
In terms of the format it gets logged in. I'm not a backend dev. Probably best to research some articles or reach out to the community on the Tezos slack and ask for opinions on what would be a good pattern to follow to make it easy to consume.
Data i'm looking for to debug problems:
-
The URL that was requested
-
The URL parameters sent to it
-
The JSON body sent to it
-
The headers sent to it
-
The HTTP status code that was returned for the given request
-
The JSON body that was returned for the given request
How will it be used:
Logs will be made available to our team via Grafana. If users report error messages such as "invalid.constant", "insufficient_funds", "invalid_address" being displayed in the app. I will search for these error messages on the given day and walk backwards to see what request data was sent, that triggered this error.
Internal Errors:
I haven't yet seen how internal errors are logged by the Tezos node. I know we have had issues receiving 404's when trying to remotely forge, or receiving 500's intermittently. Again logging as much detail about these as possible so that we can determine if it is connected to our environment, or if we need to raise another issue.