Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gateway needs to log all the requests for better logging #7873

Closed
dmellos opened this issue Jan 20, 2021 · 5 comments
Closed

Gateway needs to log all the requests for better logging #7873

dmellos opened this issue Jan 20, 2021 · 5 comments
Labels
effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers help wanted Seeking public contribution on this issue kind/feature A new feature P3 Low: Not priority right now topic/gateway Topic gateway

Comments

@dmellos
Copy link

dmellos commented Jan 20, 2021

https://discuss.ipfs.io/t/ipfs-logging-configuration/9771/8

I am trying to download the content from the gateway. I do not see any logs for my requests in the ipfs logs.
What if the hash I am using is incorrect?
What if one ipfs node (not having the content on its ow repo) is waiting for an another node to get the data?

I need to see these details in the logs, but there are no logs for gateway requests.

@dmellos dmellos added kind/feature A new feature need/triage Needs initial labeling and prioritization labels Jan 20, 2021
@ipfs ipfs deleted a comment from welcome bot Mar 22, 2021
@lidel
Copy link
Member

lidel commented Mar 22, 2021

Re-posting comment from the forums:

I had a quick look, and it may be that the gateway handlers are not logging much at all. I see no calls to around here log.Info/Debug(...)

https://github.com/ipfs/go-ipfs/blob/2ed9254426e900cf00a9b35304dc5b5de8173208/core/corehttp/gateway_handler.go#L154

**I recommend opening a feature request in go-ipfs about better logging of gateway requests [..]

Your best-shot workaround, however, is to put the IPFS gateway behind an nginx reverse proxy, which will log everything you want and let you control other stuff that IPFS does not allow to customize (max request body size, timeouts etc).

So the action here would be to add some additional Debug lines so one can enable useful gateway logs via ipfs log level command.
That is a sensible request in my opinion.

Bare minimum would be to log for each request, a pair:

{incoming HTTP request URL} → {actual content path}

@dmellos would the above be enough, or would you be interested in any additional info?

@lidel lidel added the need/author-input Needs input from the original author label Mar 22, 2021
@dmellos
Copy link
Author

dmellos commented Mar 22, 2021

@lidel , I think lets include HTTP response status and request type (GET/POST) along with request URL and the content path, and that should be enough.

@Stebalien Stebalien added exp/beginner Can be confidently tackled by newcomers help wanted Seeking public contribution on this issue topic/gateway Topic gateway effort/hours Estimated to take one or several hours P3 Low: Not priority right now and removed need/author-input Needs input from the original author need/triage Needs initial labeling and prioritization labels Apr 22, 2021
@sujanasowrirajan
Copy link

Hello! I can pick this up if no one is working on it.

Would this log line work?
{request type} {incoming HTTP request URL} → {actual content path}

And adding a debug log for all errors in webErrorWithCode to see the reason for failure:
https://github.com/ipfs/go-ipfs/blob/2ed9254426e900cf00a9b35304dc5b5de8173208/core/corehttp/gateway_handler.go#L701

@manute
Copy link
Contributor

manute commented Oct 17, 2021

Hey 👋 ,

I've created this #8518 for addressing this issue.

Thanks!

@shohamc1
Copy link

This should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours exp/beginner Can be confidently tackled by newcomers help wanted Seeking public contribution on this issue kind/feature A new feature P3 Low: Not priority right now topic/gateway Topic gateway
Projects
None yet
Development

No branches or pull requests

7 participants