ceramicnetwork / js-ceramic

Typescript implementation of the Ceramic protocol
http://ceramic.network
Other
414 stars 127 forks source link

feat: log http POST requests body in http-access log #3214

Closed stbrody closed 2 months ago

stbrody commented 5 months ago

Example log line from the POST request to create a new stream with the genesis commit:

[Tue, 23 Apr 2024 21:11:40 GMT] service=http-access ip=127.0.0.1 ts=2024-04-23T21:11:40.348Z method=POST original_url=/api/v0/streams base_url=/api/v0/streams path=/ params=-  body.type=0 body.genesis={"jws":{"payload":"AXESIDoayVr8HX8osV-ubuCJIrM9d7Xs6bJnmwTXbpO7pTJW","signatures":[{"protected":"eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa2oyUVQ4blpvaWF1WGNhMVA0SDZ6d0RqTjlSUDNORFdHazFBWFVkaGgyTjVwI3o2TWtqMlFUOG5ab2lhdVhjYTFQNEg2endEak45UlAzTkRXR2sxQVhVZGhoMk41cCJ9","signature":"78ikyfrUnOHtXXmSkeP6Y0nq9eEmV_Hw-tqNtWWsbIiDIMKdEgrjlZhlewlDjgrkBYTjvqtVSDqgufNA2NiYBA"}],"link":"bafyreib2dlevv7a5p4ulcx5on3qisivthv33l3hjwjtzwbgxn2j3xjjsky"},"linkedBlock":"omRkYXRhoWRzdGVwAGZoZWFkZXKiZnVuaXF1ZXA2VUM3YmxPQ2RWVW1VNUQva2NvbnRyb2xsZXJzgXg4ZGlkOmtleTp6Nk1rajJRVDhuWm9pYXVYY2ExUDRINnp3RGpOOVJQM05EV0drMUFYVWRoaDJONXA"} body.opts={"anchor":true,"publish":true,"sync":0,"syncTimeoutSeconds":0} http_version=1.1 req_header- status=200 content_length=379 content_type="application/json; charset=utf-8" ref=- user_agent="node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" elapsed_ms=82.153 error_message="-" error_code=-
linear[bot] commented 5 months ago

CORE-189 http-access logs don't show request params

stbrody commented 5 months ago

also assuming you tested the morgan.token code

Not quite sure what you mean by this? The testing I did was running the node, sending http requests to the node, and looking at the log messages generated.

gvelez17 commented 5 months ago

also assuming you tested the morgan.token code

Not quite sure what you mean by this? The testing I did was running the node, sending http requests to the node, and looking at the log messages generated.

yeah i meant if there were unit tests, its fine

Are we logging every request? i'm still concerned we could fill up disks with this stuff - hopefully we could log this much detail only on error?

stbrody commented 5 months ago

yeah, agreed this is too verbose right now. We should not merge this without some controls to avoid filling the log with literally every document written to Ceramic.

stbrody commented 2 months ago

This PR needs more work to be ready to merge, and since js-ceramic is dying soon and we've made it this long without this working, going to go ahead and close this unmerged