ipfs-webui icon indicating copy to clipboard operation
ipfs-webui copied to clipboard

feat: settings screen - allow adjusting kubo log level

Open SgtPooki opened this issue 1 year ago • 8 comments

Is your feature request related to a problem? Please describe.

We should allow users to configure the log level of their Kubo node from the webui settings screen.

Describe the solution you'd like

Create some config UI options in the settings page that will cause a call to https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-log-level to happen, to set the log level.

Describe alternatives you've considered

  • Allow setting Env vars for the ipfsd-ctl in ipfs-desktop - doesn't solve need for ipfs-webui users.

Additional context

We could have an entry like this for key:value view and adding/removing ${subsystem}:${logLevel} settings:

image

Bonus item

  • It would be great if we could allow users to select the subsystem from the list of log items output by https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-log-ls

SgtPooki avatar Nov 14 '24 16:11 SgtPooki

Somehow related, if we fixed https://github.com/ipfs/kubo/issues/9245 we could show logs in realtime in the webui, similar to how github actions print logs.

Also, we may decide to move this from "Settings" to a new "Diagnostics" screen, that has tabs at the top, and "Logs" sub-screen would be one of them.

lidel avatar Nov 14 '24 18:11 lidel

Hi @SgtPooki I am interested in implementing this. Do you know if there is an api to read the current log level of the subsystems to show in the UI? I am only finding this can be done if the log level was set through updating the config file.

karlrez avatar Jan 14 '25 02:01 karlrez

@karlrez I believe we can set log-level via kubo-rpc-client. You can see the code for that here: https://github.com/ipfs/js-kubo-rpc-client/tree/main/src/log

I haven't tested it myself, so it may not work, but it should.

Also, if you do take this on, I do not think we should go with key:value table UI for log levels, and instead just have a GOLOG_LOG_LEVEL text input.

SgtPooki avatar Feb 04 '25 14:02 SgtPooki

HI @SgtPooki Are there any known limitations or considerations when calling the api/v0/log/level or api/v0/log/ls endpoints in Kubo?

shobit000 avatar Apr 13 '25 18:04 shobit000

HI @SgtPooki Are there any known limitations or considerations when calling the api/v0/log/level or api/v0/log/ls endpoints in Kubo?

I am not aware of any.. the documentation for those calls are at https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-log-level

SgtPooki avatar Apr 16 '25 15:04 SgtPooki

@SgtPooki Is this close to how you think the text input should look? The main limitations I've found is the api does not have a route to read the current log level and also the change does not persist between restarts.

Image

karlrez avatar May 04 '25 02:05 karlrez

@SgtPooki Is this close to how you think the text input should look?

I think we might need to make it a single input field and then parse it, so it would be the same as what someone would type on the command line. e.g. GOLOG_LOG_LEVEL="error,autotls=debug" would just put error,autotls=debug into the input field. We would split on commas and set logging level for all if there is no =, and on each subsystem where there is an =

The main limitations I've found is the api does not have a route to read the current log level and also the change does not persist between restarts.

If the log-level is not empty, we should probably set that log level when ipfs-webui boots up, or connects to the daemon.

SgtPooki avatar May 06 '25 14:05 SgtPooki

Hi @SgtPooki apologies for the delay, but I got the PR up for this now. Please let me know your thoughts! I will be more than happy to come back to this and revise or add any additional functionality.

karlrez avatar May 21 '25 02:05 karlrez