-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
HTTP API: Logging #574
Comments
@hsanjuan I don't understand the jump to using echo from needing a single
place to put logs
…On Thu., 11 Oct. 2018, 10:57 Hector Sanjuan, ***@***.***> wrote:
Pre-check
- This is not a IPFS Cluster website content issue (file those here
<https://github.com/ipfs/ipfs-cluster-website/issues>)
- I read the troubleshooting section
<https://cluster.ipfs.io/documentation/troubleshooting/> of the
website and it did not help
- I searched for similar issues in the repo without luck
- All my peers are running the same cluster version
- All my peers are configured using the same cluster secret
Basic information
- Version information (mark as appropiate):
- Master
- Release candidate for next version
- Latest stable version
- An older version I should not be using
- Type (mark as appropiate):
- Bug
- Feature request
- Enhancement
Description
Our HTTP API currently does not do any logging that includes request,
return codes, duration etc... (webserver-like). We should enable this just
like any other webserver. We should also have a way to log, in the case of
authorized requests (with basic auth), which requests were performed by
which user.
We likely want these logs to be specific to the API component and have
them written out separately from the usual output, and stored somewhere (
/var/log/ipfs-cluster?).
To discuss:
- Where to put these logs (if anywhere)
- If this should be enabled by default
- If this compels us to start using https://echo.labstack.com/ (and
rewriting the API with it?)
cc. @lanzafame <https://github.com/lanzafame>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#574>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFpnaEa_-JiNgiurSLFF0csT4hgI3Jvoks5ujxYKgaJpZM4XXMWc>
.
|
my 2 cents that maybe can help: echo is not really needed for what they have, sometimes using a framework is more painful than actually just integrating with the "lower level" api of go. I am using a lot https://github.com/Sirupsen/logrus with some custom variables that are enabling different kind of logs and customisation to print to stdout vs stderr etc etc As I am an heavy user of docker, I suggest to still use stdout instead of dumping logs in a file. Or make it optional to dump them somewhere. :D |
echo makes it super easy to add logging and some other things that are useful in APIs (auth, cors etc), but I'm happy not using it too. |
what is this issue blocked on? |
discussion |
Actionables here:
|
https://httpd.apache.org/docs/1.3/logs.html seems to be a good resource about how to do this. |
things that we would want to log loglevel(error, access), host, time, method, path, protocol, status, error, response size |
Please see and use https://www.gorillatoolkit.org/pkg/handlers#LoggingHandler |
Also the custom one: https://github.com/gorilla/handlers/blob/master/logging.go#L253 |
This commit introduces logging for Cluster HTTP APIs. It adds a config element `send_logs_to_file`, which tells whether logs should be saved in a file or shown in standard output. Requests are logged as per Apache Common Log Format (CLF) http://httpd.apache.org/docs/2.2/logs.html#common Fixes #574
Basic information
Description
Our HTTP API currently does not do any logging that includes request, return codes, duration etc... (webserver-like). We should enable this just like any other webserver. We should also have a way to log, in the case of authorized requests (with basic auth), which requests were performed by which user.
We likely want these logs to be specific to the API component and have them written out separately from the usual output, and stored somewhere (
/var/log/ipfs-cluster
?).To discuss:
cc. @lanzafame
The text was updated successfully, but these errors were encountered: