xavier-hernandez / goaccess-for-nginxproxymanager

GoAccess Docker Image for Nginx Proxy Manager and more...
https://hub.docker.com/r/xavierh/goaccess-for-nginxproxymanager
MIT License
532 stars 39 forks source link

Request: Add support for error logs #126

Closed kmanwar89 closed 1 year ago

kmanwar89 commented 1 year ago

Would it be possible to add the ability to view the proxy-host-##_error.log files that NPM generates?

For instance, here's the output in my logs folder:

❯ ls | grep _error
fallback_error.log
fallback_error.log.1.gz
proxy-host-22_error.log
proxy-host-22_error.log.1.gz
proxy-host-55_error.log
proxy-host-55_error.log.1.gz
proxy-host-56_error.log
proxy-host-56_error.log.1.gz
proxy-host-57_error.log
proxy-host-57_error.log.1.gz
proxy-host-59_error.log
proxy-host-59_error.log.1.gz
proxy-host-60_error.log
proxy-host-62_error.log
proxy-host-63_error.log
proxy-host-63_error.log.1.gz
proxy-host-64_error.log
proxy-host-66_error.log
proxy-host-66_error.log.1.gz
proxy-host-67_error.log
proxy-host-67_error.log.1.gz
proxy-host-69_error.log
proxy-host-69_error.log.1.gz
proxy-host-70_error.log
proxy-host-70_error.log.1.gz
proxy-host-74_error.log
proxy-host-74_error.log.1.gz
proxy-host-75_error.log
proxy-host-75_error.log.1.gz
proxy-host-76_error.log
proxy-host-76_error.log.1.gz
proxy-host-77_error.log
proxy-host-77_error.log.1.gz
proxy-host-78_error.log
proxy-host-78_error.log.1.gz
proxy-host-79_error.log
proxy-host-79_error.log.1.gz
proxy-host-80_error.log
proxy-host-81_error.log
proxy-host-82_error.log
proxy-host-82_error.log.1.gz
proxy-host-83_error.log
proxy-host-83_error.log.1.gz
proxy-host-84_error.log
proxy-host-84_error.log.1.gz

Ignoring the .gz files, if I view the contents of some of the error logs using a quick one-liner (I deleted out the empty files from the below output to make it cleaner):

❯ for i in proxy-host-{1..100}_error.log; cat $i
2023/01/22 16:58:55 [warn] 1086876#1086876: *863891 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/4/46/0000146464 while reading upstream, client: 192.168.1.1, server: draw.kadaranwar.com, request: "GET /js/app.min.js HTTP/2.0", upstream: "http://172.19.0.9:8080/js/app.min.js", host: "draw.kadaranwar.com", referrer: "https://draw.kadaranwar.com/"
2023/01/22 16:58:55 [warn] 1086876#1086876: *863891 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/5/46/0000146465 while reading upstream, client: 192.168.1.1, server: draw.kadaranwar.com, request: "GET /js/stencils.min.js HTTP/2.0", upstream: "http://172.19.0.9:8080/js/stencils.min.js", host: "draw.kadaranwar.com", referrer: "https://draw.kadaranwar.com/"
2023/01/22 16:58:55 [warn] 1086876#1086876: *863891 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/6/46/0000146466 while reading upstream, client: 192.168.1.1, server: draw.kadaranwar.com, request: "GET /js/extensions.min.js HTTP/2.0", upstream: "http://172.19.0.9:8080/js/extensions.min.js", host: "draw.kadaranwar.com", referrer: "https://draw.kadaranwar.com/"
2023/01/22 16:58:55 [warn] 1086876#1086876: *863891 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/7/46/0000146467 while reading upstream, client: 192.168.1.1, server: draw.kadaranwar.com, request: "GET /math/es5/input/tex.js HTTP/2.0", upstream: "http://172.19.0.9:8080/math/es5/input/tex.js", host: "draw.kadaranwar.com", referrer: "https://draw.kadaranwar.com/"
2023/01/22 16:58:55 [warn] 1086876#1086876: *863891 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/8/46/0000146468 while reading upstream, client: 192.168.1.1, server: draw.kadaranwar.com, request: "GET /math/es5/output/svg.js HTTP/2.0", upstream: "http://172.19.0.9:8080/math/es5/output/svg.js", host: "draw.kadaranwar.com", referrer: "https://draw.kadaranwar.com/"
2023/01/22 16:58:55 [warn] 1086876#1086876: *863891 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/9/46/0000146469 while reading upstream, client: 192.168.1.1, server: draw.kadaranwar.com, request: "GET /math/es5/output/svg/fonts/tex.js HTTP/2.0", upstream: "http://172.19.0.9:8080/math/es5/output/svg/fonts/tex.js", host: "draw.kadaranwar.com", referrer: "https://draw.kadaranwar.com/"
2023/01/22 16:56:25 [error] 1085452#1085452: *863681 goaccess could not be resolved (2: Server failure) while sending to client, client: 192.168.1.1, server: logs.kadaranwar.com, request: "GET / HTTP/2.0", host: "logs.kadaranwar.com", referrer: "https://npm.kadaranwar.com/"
2023/01/22 16:56:25 [error] 1085452#1085452: *863681 goaccess could not be resolved (2: Server failure), client: 192.168.1.1, server: logs.kadaranwar.com, request: "GET /favicon.ico HTTP/2.0", host: "logs.kadaranwar.com", referrer: "https://logs.kadaranwar.com/"
2023/01/22 16:57:06 [error] 1086823#1086823: *863774 goaccess could not be resolved (2: Server failure) while sending to client, client: 192.168.1.1, server: logs.kadaranwar.com, request: "GET / HTTP/2.0", host: "logs.kadaranwar.com"
2023/01/22 16:59:12 [error] 1086876#1086876: *864036 goaccess could not be resolved (2: Server failure) while sending to client, client: 192.168.1.1, server: logs.kadaranwar.com, request: "GET / HTTP/2.0", host: "logs.kadaranwar.com", referrer: "https://home.kadaranwar.com/"

Is it possible to get these included as well? Thanks!

xavier-hernandez commented 1 year ago

I can take a look at these, but they might be in a different format. I had to create a separate instance for redirections logs since those were different formats. I'll look into this.

xavier-hernandez commented 1 year ago

@kmanwar89 I've added a 3rd instance to the app. Please review the README file.

Basically, change the LOG_TYPE to "NPM+ALL". http://localhost:7880 - analyzes regular logs http://localhost:7880/redirection/ - analyzes redirection logs http://localhost:7880/error/ - analyzes error logs

kmanwar89 commented 1 year ago

Thanks!!!