ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
15.98k stars 3k forks source link

daemon logs requests #5795

Open bohendo opened 5 years ago

bohendo commented 5 years ago

Version information:

I'm running docker image ipfs/go-ipfs:latest aka

$ ipfs version --all
go-ipfs version: 0.4.18-6f19dd5
Repo version: 7
System version: amd64/linux
Golang version: go1.11.1

Type:

Feature (+ related bug)

Description:

I'm preparing to administer an IPFS node & am having trouble with logs. The logs that I'm interested in are: Timestamp, HTTP endpoint, result, latency. The goal is to monitor the interactions this IPFS node has with it's clients. For example, something like this would be awesome:

181124T06:58:22Z api/v0/add - success in 123 ms
181124T06:59:22Z api/v0/pin - failure: forbidden 403 in 23 ms 

Looks like the current system does not provide any option to start the daemon in a way that provides useful logs like this & would be overjoyed if a feature was added that provided this functionality.

Seems like my current options are:

According to ipfs daemon --help and ipfs help, I don't have any options. Some options are available though & I'd prefer to be able to discover them via this help interface.

I discovered ipfs daemon --verbose from issue #1816 which has a signal-to-noise ratio of almost 0

The same issue also introduced ipfs log level which I'm trying to use like so:

ipfs log level all critical # I expect this to turn off all logs besides critical ones
ipfs log level eventlog info # I expect this to only turn on logs for the "eventlog" module
ipfs log tail # I expect this to print logs according to my log level changes above

But the above set of commands seems to ignore the log level updates & just print out everything. For example, most of the logs that are printed include stuff like "system":"dht" and "system":"addrutil" which suggests that logs other than those from the eventlog system are being printed. This may be a bug or potentially a misunderstanding on my end.

I also don't know if "eventlog" is the system that contains the logs I want. "cmds/http" Also sounds promising but I don't know where the documentation is that would explain this, any guidance would be greatly appreciated.

IPFS is going to change the world, thank you for all the work you've put into this project 😁

bohendo commented 5 years ago

Further discussion & advice would be greatly appreciated 😄

https://discuss.ipfs.io/t/how-to-administer-an-ipfs-node-to-decentralize-dao-data/4328

Stebalien commented 5 years ago

At the moment, the best way to do this is with an nginx reverse proxy. You can also poll ipfs diag cmds but that's obviously a bit messy.

Really, you shouldn't be exposing the API to the public internet without sticking some reverse proxy out in front to restrict requests to some allowed set.