tobychui / zoraxy

A general purpose HTTP reverse proxy and forwarding tool. Now written in Go!
https://zoraxy.arozos.com
GNU Affero General Public License v3.0
2.62k stars 152 forks source link

[ENHANCEMENTS] Make logs more present / Integrate different log levels #243

Closed Morethanevil closed 1 month ago

Morethanevil commented 1 month ago

The new logviewer is good, but it should be more present in the UI since they are important. Something like this:

Bildschirmfoto_20240715_141600

A small download button on the selected log would be great too, beneath the "Open in new tab". Logs are hard to read in the browser, so this would help.

Another helpful feature would be a filter for different loglevels, like "System, Error, Info, Warn" etc..

Example:

This is the current log:

2024-02-18 13:25:02.443774|info             [INFO]mDNS scan result updated
2024-02-18 13:40:02.443727|info             [INFO]mDNS scan result updated
2024-02-18 13:47:30.452141|info             [INFO]Failed to load ZeroTier controller API authtoken
2024-02-18 13:47:30.481408|info             [INFO]Starting ACME handler
2024-02-18 13:47:30.481705|info             [INFO]Serving inbound port 443
2024-02-18 13:47:30.481717|info             [INFO]TLS mode enabled. Serving proxxy request with TLS
2024-02-18 13:47:30.481729|info             [INFO]Development mode enabled. Using no-store Cache Control policy
2024-02-18 13:47:30.481737|info             [INFO]Force latest TLS mode enabled. Minimum TLS LS version is set to v1.2
2024-02-18 13:47:30.481747|info             [INFO]Port 80 listener enabled
2024-02-18 13:47:30.481766|info             [INFO]Force HTTPS mode enabled
2024-02-18 13:47:30.481931|Proxy            [INFO]b.domain.com -> 172.20.0.7:25600 routing rule loaded
2024-02-18 13:47:30.481936|Proxy            [INFO]c.domain.com -> localhost:8980 routing rule loaded
2024-02-18 13:47:30.482006|Proxy            [INFO]j.domain.com  -> localhost:9320 routing rule loaded
2024-02-18 13:47:30.482013|Proxy            [INFO]o.domain.com  -> 172.20.0.15:8080 routing rule loaded
2024-02-18 13:47:30.482001|Proxy            [INFO]i.domain.com -> 172.20.0.16:3000 routing rule loaded
2024-02-18 13:47:30.482030|Proxy            [INFO]p.domain.com  -> [fd00:112::2]:3001 routing rule loaded
2024-02-18 13:47:30.482052|Proxy            [INFO]/ -> 127.0.0.1:5487 routing rule loaded
2024-02-18 13:47:30.482056|Proxy            [INFO]pl.domain.com  -> [fd00:112::5]:8000 routing rule loaded
2024-02-18 13:47:30.782618|info             [INFO]Dynamic Reverse Proxy service started
2024-02-18 13:47:30.805320|info             [INFO]Uptime Monitor background service started
2024-02-18 13:47:30.981779|info             [INFO]Assigned temporary port:38285
2024-02-18 13:47:30.981807|info             [INFO]Zoraxy started. Visit control panel at http://localhost:8400
2024-02-18 13:48:00.133125|info             [INFO]mDNS Startup scan completed
2024-02-18 14:03:00.133435|info             [INFO]mDNS scan result updated
2024-02-18 14:18:00.134228|info             [INFO]mDNS scan result updated
2024-02-18 14:33:00.134319|info             [INFO]mDNS scan result updated
2024-02-18 14:48:00.133872|info             [INFO]mDNS scan result updated
2024-02-18 15:03:00.134798|info             [INFO]mDNS scan result updated
2024-02-18 15:18:00.134482|info             [INFO]mDNS scan result updated
2024-02-18 15:33:00.134279|info             [INFO]mDNS scan result updated
2024-02-18 15:48:00.134032|info             [INFO]mDNS scan result updated
2024-02-18 16:03:00.134567|info             [INFO]mDNS scan result updated
2024-02-18 16:18:00.133640|info             [INFO]mDNS scan result updated
2024-02-18 16:33:00.134127|info             [INFO]mDNS scan result updated
2024-02-18 16:48:00.134738|info             [INFO]mDNS scan result updated
2024-02-18 17:03:00.133906|info             [INFO]mDNS scan result updated
2024-02-18 17:18:00.133246|info             [INFO]mDNS scan result updated
2024-02-18 17:33:00.133902|info             [INFO]mDNS scan result updated

If I don't need the INFO section, I would like to filter this out.

The new log could look like this:

2024-02-18 13:47:30.452141|warn             [WARN]Failed to load ZeroTier controller API authtoken
2024-02-18 13:47:30.481408|system             [SYSTEM]Starting ACME handler
2024-02-18 13:47:30.481705|system             [SYSTEM]Serving inbound port 443
2024-02-18 13:47:30.481717|system             [SYSTEM]TLS mode enabled. Serving proxxy request with TLS
2024-02-18 13:47:30.481729|system             [SYSTEM]Development mode enabled. Using no-store Cache Control policy
2024-02-18 13:47:30.481737|system             [SYSTEM]Force latest TLS mode enabled. Minimum TLS LS version is set to v1.2
2024-02-18 13:47:30.481747|system             [SYSTEM]Port 80 listener enabled
2024-02-18 13:47:30.481766|system             [SYSTEM]Force HTTPS mode enabled
2024-02-18 13:47:30.481931|Proxy            [PROXY]b.domain.com -> 172.20.0.7:25600 routing rule loaded
2024-02-18 13:47:30.481936|Proxy            [PROXY]c.domain.com -> localhost:8980 routing rule loaded
2024-02-18 13:47:30.482006|Proxy            [PROXY]j.domain.com  -> localhost:9320 routing rule loaded
2024-02-18 13:47:30.482013|Proxy            [PROXY]o.domain.com  -> 172.20.0.15:8080 routing rule loaded
2024-02-18 13:47:30.482001|Proxy            [PROXY]i.domain.com -> 172.20.0.16:3000 routing rule loaded
2024-02-18 13:47:30.482030|Proxy            [PROXY]p.domain.com  -> [fd00:112::2]:3001 routing rule loaded
2024-02-18 13:47:30.482052|Proxy            [PROXY]/ -> 127.0.0.1:5487 routing rule loaded
2024-02-18 13:47:30.482056|Proxy            [PROXY]pl.domain.com  -> [fd00:112::5]:8000 routing rule loaded
2024-02-18 13:47:30.782618|system             [SYSTEM]Dynamic Reverse Proxy service started
2024-02-18 13:47:30.805320|system             [SYSTEM]Uptime Monitor background service started
2024-02-18 13:47:30.981779|system             [SYSTEM]Assigned temporary port:38285
2024-02-18 13:47:30.981807|system             [SYSTEM]Zoraxy started. Visit control panel at http://localhost:8400
2024-02-18 13:47:30.981807|error             [ERROR] Pizza not loaded! :(
tobychui commented 1 month ago

Hi there @Morethanevil,

That was the old log format you see. The new log format looks like this, which includes the HTTP proxy request records. https://github.com/tobychui/zoraxy/issues/218#issuecomment-2227247452

In fact the reason why I pick the apache log format is that, if you need more advance log analysis, you can use some other already existing open source log analysis tools like graylog. But yeah, those simple filters should not be too hard to add.

Morethanevil commented 1 month ago

Thank you 😃

AzAel76 commented 1 month ago

Adding a +1 to have a log button on the main menu.

tobychui commented 1 month ago

圖片

Log filter has been added. The log button on the main menu I think will get into the won't fix category as the main menu is already full enough. Instead, I am currently thinking a top menu next to the log-out buttons for some important features and shortcuts. If anyone is interested to contribute some design ideas, feel free to open a new issue on this 👍🏻