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

Add Log Viewer (Frontail) to the Developer Tools

Open kubawolanin opened this issue 3 years ago β€’ 6 comments

Welcome back! πŸ‘‹πŸ»

This PR draft introduces Log Viewer (Frontail) embedded directly in the UI. image

It also reacts to filter query string and passes it to Frontail, so we're able to quickly diagnose a problem: image

Drawbacks:

  • Frontail port is currently hardcoded to 9001 as I couldn't find a proper place to add it as a configuration param. Basic UI offers some sort of settings (dark theme, png/svg icons etc), which main UI is currently missing.
  • This will only work locally (as it tries to access window.location.origin with replaced port

Side note: it would be nice to introduce some sort of feature flag system in the main UI, so we're able to gradually turn on that kind of features to the broader audience (experiments?), make it's presence toggleable on the UI and ultimately - merge bigger changes (even not necessarily completed) more frequently, without them affecting the UX.

@ghys chapeau bas, awesome job on the UI!

Cheers, Kuba

Signed-off-by: Kuba Wolanin [email protected]

kubawolanin avatar Jun 20 '21 19:06 kubawolanin

Job #163: Bundle Size β€” 10.47MB (+0.02%).

e4d29226a5586d3976587774d552f8955cc23e5b vs a1fd06a5bd9eb04e25ee67f31942dbdab26ae643

Changed metrics (3/8)
Metric Current Baseline
Initial JS 1.61MB(+0.03%) 1.6MB
Cache Invalidation 15.76% 35.3%
Modules 1487(+0.13%) 1485
Changed assets by type (2/7)
            Current     Baseline
CSS 837.62KB (+0.04%) 837.25KB
JS 8.2MB (+0.02%) 8.2MB

View Job #163 report on app.relative-ci.com

relativeci[bot] avatar Jun 20 '21 19:06 relativeci[bot]

As you know Frontail is not part of the openHAB distribution per se, so we can't expect it to run on port 9001 by default, or at all, in which case this option shouldn't be displayed. On the other hand, we can expect a sizable amount of users having opted to run openHAB on top of openHABian. I think a sensible approach would be for openHABian to install a dedicated bundle whose purpose would be to add a "supervisor" REST API endpoint (/rest/supervisor or /rest/openhabian...), offering features beyond OH's scope:

  • advertising which additional software is installed (Frontail, Grafana etc. and on which ports)
  • retrieving system logs, event logs, application logs (and perhaps streaming them)
  • package updates etc. That additional API endpoint would be detected by the UI when loading the /rest/ root endpoint and would be used to unlock these additional options when relevant.

ghys avatar Aug 03 '21 13:08 ghys

Side note: it would be nice to introduce some sort of feature flag system in the main UI, so we're able to gradually turn on that kind of features to the broader audience (experiments?), make it's presence toggleable on the UI and ultimately - merge bigger changes (even not necessarily completed) more frequently, without them affecting the UX.

For now I have avoided making a configurable service for the UI (to have a place to store the UI-related server-wide options - that's why the options in Help & About are local only), partly because it would be yet another request before anything is displayed, but mostly because now /rest/services is restricted to admins. Ultimately a place to store UI-related options on the server could become necessary indeed.

ghys avatar Aug 03 '21 13:08 ghys

One option that would be great to have is to turn off the watching of event.log so only the openhab.log is watched with a checkbox or some other control. I find the events annoying in frontail and prefer to use the Event Monitor that is in the Developer sidebar. Currently I turn the event.log to WARN level to achieve this.

Skinah avatar Aug 12 '21 08:08 Skinah

One option that would be great to have is to turn off the watching of event.log so only the openhab.log is watched with a checkbox or some other control. I find the events annoying in frontail and prefer to use the Event Monitor that is in the Developer sidebar. Currently I turn the event.log to WARN level to achieve this.

You can simply remove the events.log entry in the frontail.service file. That's how I did it.

hmerk avatar Dec 28 '21 13:12 hmerk

are there any news here? is this feature included in the next release? it would be very usefull for me.

Gifford47 avatar Oct 06 '22 10:10 Gifford47

are there any news here? is this feature included in the next release? it would be very usefull for me.

Sadly Kuba passed last summer. There will be no follow up from his account on this pull request.

splatch avatar Apr 24 '23 12:04 splatch

I have now closed this PR as it went stale. Probably we will have a log viewer one day powered to the log WebSocket.

May Kuba rest in peace!

florian-h05 avatar Feb 26 '24 15:02 florian-h05