Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple logs being generated by NGINX proxy #2776

Open
huntson opened this issue Dec 31, 2024 · 7 comments
Open

Multiple logs being generated by NGINX proxy #2776

huntson opened this issue Dec 31, 2024 · 7 comments

Comments

@huntson
Copy link

huntson commented Dec 31, 2024

I've got a different log file being generated by each config of NGINX proxy as such:

access.log* proxy-host-6_error.log*
default-host_access.log* proxy-host-7_access.log*
default-host_error.log* proxy-host-7_error.log*
fallback_access.log* proxy-host-8_access.log*
fallback_error.log* proxy-host-8_error.log*
proxy-host-3_access.log* redirection-host-1_access.log*
proxy-host-3_error.log* redirection-host-1_error.log*

Is there a way to deal with this in goaccess or does the NGINX config need to be modified somehow?

@allinurl
Copy link
Owner

You can grab all the access logs and pipe them straight into GoAccess, e.g.,

cat access.log* proxy-host-6_error.log* default-host_access.log* proxy-host-7_access.log* default-host_error.log* proxy-host-7_error.log* fallback_access.log* proxy-host-8_access.log* fallback_error.log* proxy-host-8_error.log* proxy-host-3_access.log* redirection-host-1_access.log* proxy-host-3_error.log* redirection-host-1_error.log* | goaccess - -o report.html --log-format=COMBINED

or

find . -type f -name 'access.log*' -o -name 'proxy-host-*-access.log*' -o -name 'default-host*_access.log*' -o -name 'fallback_access.log*' -o -name 'redirection-host-*-access.log*' | xargs cat | goaccess - -o report.html --log-format=COMBINED

@huntson
Copy link
Author

huntson commented Dec 31, 2024

The issue is that as I create more hosts/proxies the number of logs increases. Is there a way to honor any files with the dot log extension in a folder?

@allinurl
Copy link
Owner

If I understand correctly, you could try, e.g.:

find . -type f -name '*.log*' ! -name '*error*' | xargs cat | goaccess - -o report.html --log-format=COMBINED

@huntson
Copy link
Author

huntson commented Dec 31, 2024

How/where does this get put in the config file as I'm running this as a Docker and need this in the config.

@allinurl
Copy link
Owner

allinurl commented Jan 1, 2025

find . -type f -name '*.log*' ! -name '*error*' | xargs cat | docker run --rm -i -v "$(pwd)/report.html:/report.html" -e LANG=$LANG allinurl/goaccess - -o /report.html --log-format=COMBINED

https://github.com/allinurl/goaccess?tab=readme-ov-file#docker

@huntson
Copy link
Author

huntson commented Jan 1, 2025

I don't think we're on the same page here. I'm using Portainer to maintain a stack where this is the config:

goaccess:
    image: gregyankovoy/goaccess
    container_name: goaccess
    ports:
      - "7889:7889"  
    environment:
      - PUID=1026 
      - PGID=100   
    volumes:
      - /share/ZFS20_DATA/docker/nginx-proxy/logs:/opt/log  
      - /share/ZFS20_DATA/docker/goaccess:/config 

I'm attempting to understand how to modify the config file in order to allow this to work within Portainer and not call the docker via CLI.

@allinurl
Copy link
Owner

allinurl commented Jan 3, 2025

I'm not very familiar with Portainer, but it seems you could try the following:

services:
  goaccess:
    image: gregyankovoy/goaccess
    container_name: goaccess
    ports:
      - "7889:7889"
    environment:
      - PUID=1026
      - PGID=100
    volumes:
      - /share/ZFS20_DATA/docker/nginx-proxy/logs:/opt/log  # Logs directory
      - /share/ZFS20_DATA/docker/goaccess:/config          # Config and output
    command: >
      /bin/sh -c "
      find /opt/log -type f -name '*.log*' ! -name '*error*' | 
      xargs cat | 
      goaccess - --real-time-html -o /config/report.html --log-format=COMBINED --daemonize"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants