nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

How to collect access logs?

Open ck003 opened this issue 7 years ago • 10 comments

Hello , Thanks for your sharing . How can I collect access logs because I want to know who have accessed my server , and I want to know their IP address, please help

ck003 avatar Apr 23 '19 03:04 ck003

@jc21

ck003 avatar Apr 23 '19 03:04 ck003

Not sure, but I think you can mount a host directory to /var/log/nginx. For instance: docker run -d
--name nginx-proxy-manager-app
-p 80:80
-p 81:81
-p 443:443
-v /path/to/config.json:/app/config/production.json
-v /path/to/logs:/var/log/ninx
-v /path/to/data:/data
-v /path/to/letsencrypt:/etc/letsencrypt
jc21/nginx-proxy-manager:latest-armhf

kolbii avatar Apr 23 '19 18:04 kolbii

The access logs for each host created by NPM is available in the data directory you should be mounting. eg data/logs/proxy_host-10.log

jc21 avatar Apr 23 '19 21:04 jc21

Any idea where I can find these log files in Hassio addon?

ncm-lfc avatar Nov 07 '19 11:11 ncm-lfc

@ncm-lfc searching for the same. Have you found the logs?

b2az avatar Jun 23 '20 06:06 b2az

@ncm-lfc @b2az Did you find them?

jonasrubensson avatar Jul 16 '20 10:07 jonasrubensson

@jonrub @ncm-lfc @b2az you most likely don't need the info anymore, but logs are mapped to Supervisor Nginx Proxy Manager Log Tab: (https://github.com/hassio-addons/addon-nginx-proxy-manager/blob/main/proxy-manager/rootfs/etc/cont-init.d/npm.sh)

lordfiSh avatar Mar 06 '21 22:03 lordfiSh

@lordfiSh yes thx sorted it out already :)

b2az avatar Oct 15 '21 16:10 b2az

Any one looking to use ngxtop for access log monitoring and not having any luck.

I changes the conf file genarated by NPM for my host ( location: /data/nginx/proxy_host filename will be 1.conf | or similar) Inside it there is a line: access_log /data/logs/proxy-host-1_access.log proxy; changed it to: access_log /data/logs/proxy-host-1_access.log;

ngxtop can procces log after this change.

graig123 avatar Mar 05 '22 15:03 graig123

did you get it working ? I can't seem to find the path where the log file is stored.

did you found a solution to redirect the access log somewhere ? I would like to use a GoAccess for nginx proxy manager addon/docker to view a website portal with statistics. using this: https://github.com/xavier-hernandez/goaccess-for-nginxproxymanager

I did not found a HA addon for it, but I can make it with Portainer en paste a docker compose text there in the "Add Stack".

If I look at the Nginx Reverse Proxy Manager Addon with Portainer, I see following Volume mappings: image|690x199

indeed the /mnt/data/supervisor/addon_configs/a0d7b954_nginxproxymanager is under my HA samba share undder addon_configs:

image|621x444

but the other share is not under addons directory (it is empty).

Anyone got GoAccess working with the HA NPM addon logs ?

edit: I think the logs are stored with HA under /var/log/journal ? (binary files)

with : ha host logs --identifier addon_a0d7b954_nginxproxymanager under supervsor ssh you can also see the log of the NPM. Question now how to add this to the GoAccess docker compose file Volumes?

below something I tought it would be, but log is not available as file I think.

version: '3.3' services: goaccess: image: 'xavierh/goaccess-for-nginxproxymanager:latest' container_name: goaccess restart: always ports: - '7880:7880' environment: - TZ=Europe/Brussels
- SKIP_ARCHIVED_LOGS=False #optional - DEBUG=False #optional - BASIC_AUTH=False #optional - BASIC_AUTH_USERNAME=user #optional - BASIC_AUTH_PASSWORD=pass #optional
- EXCLUDE_IPS=127.0.0.1 #optional - comma delimited - LOG_TYPE=NPM #optional - more information below - ENABLE_BROWSERS_LIST=True #optional - more information below - CUSTOM_BROWSERS=Kuma:Uptime,TestBrowser:Crawler #optional - comma delimited, more information below - HTML_REFRESH=5 #optional - Refresh the HTML report every X seconds. https://goaccess.io/man - KEEP_LAST=30 #optional - Keep the last specified number of days in storage. https://goaccess.io/man - PROCESSING_THREADS=1 #optional - This parameter sets the number of concurrent processing threads in the program's execution, affecting log data analysis, typically adjusted based on CPU cores. Default is 1. https://goaccess.io/man volumes: - /mnt/data/supervisor/addons/data/a0d7b954_nginxproxymanager/logs:/opt/log - /path/to/host/custom:/opt/custom #optional, required if using log_type = CUSTOM networks: - nginxproxymanager_default

networks: nginxproxymanager_default: external: true

8OND007 avatar Sep 07 '24 10:09 8OND007