smilebasti / npmGrafStats

This project exports NginxProxyManager Logs to InfluxDB for displaying them in a Grafana Dashboard.
GNU General Public License v3.0
149 stars 10 forks source link

Container auto crashing #9

Closed cactusrent closed 1 year ago

cactusrent commented 1 year ago

Hello, upon starting up the npmgrafstats container it seems to be auto crashing immediately with the following logs posted:

Startup: lets get logs data and send them to influx
Redirection Logs activated
tail: cannot open '/logs/proxy-host-*_access.log' for reading: No such file or directory
tail: no files remaining
/root/.config/NPMGRAF/sendips.sh: line 38: reboot: command not found

I was just wondering if there is something I'm clearly doing wrong to get this started. Weirdly it kept looping a French IP address over and over again in the logs (possible it was looping through one entry?)

Attaching my config below----------

Redacted npmgrafstats docker-compose:

version: '3.8'
services:

  npmgraf:
    image: smilebasti/npmgrafstats:latest
    restart: unless-stopped
    environment:
      HOME_IPS: 'externalIP'
      REDIRECTION_LOGS: 'TRUE' # TRUE or FALSE
      INFLUX_HOST: 'hostip:8086' # use host IP
      INFLUX_BUCKET: 'npmgrafstats'
      INFLUX_ORG: 'npmgrafstats'
      INFLUX_TOKEN: 'cooltokennumber' # insert after first run and manual token creation
    volumes:
      - /data/compose/1/data/logs:/logs #nginx log location
      - ./geolite:/geolite

  influxdb:
    image: influxdb:2.7-alpine
    environment:
      DOCKER_INFLUXDB_INIT_MODE: 'setup'
      DOCKER_INFLUXDB_INIT_USERNAME: 'CoolUserName'
      DOCKER_INFLUXDB_INIT_PASSWORD: 'coolpassword' # atleast 8 characters
      DOCKER_INFLUXDB_INIT_ORG: 'npmgrafstats'
      DOCKER_INFLUXDB_INIT_BUCKET: 'npmgrafstats'
    volumes:
      # Mount for influxdb data directory and configuration
      - ./influxdbv2:/var/lib/influxdb2
    ports:
      - '8086:8086'

  geoipupdate:
    image: maxmindinc/geoipupdate
    environment:
      GEOIPUPDATE_ACCOUNT_ID: 'accountid'
      GEOIPUPDATE_LICENSE_KEY: 'geoiplicense'
      GEOIPUPDATE_EDITION_IDS: 'GeoLite2-City'
      GEOIPUPDATE_FREQUENCY: 24
    volumes:
      - ./geolite:/usr/share/GeoIP
smilebasti commented 1 year ago

Hi, it seems that there is no proxy-host-*_access.log file in /data/compose/1/data/logs (Star means any number)

The French IP shouldn't be a problem but i can test it if you want to share any proxy-host-*_access.log

Otherwise all looks fine :)

cactusrent commented 1 year ago

Thanks for getting back!

Yes there are files but we are currently only using NPM for redirects. I wonder if that could be the issue causing it to loop?

This is what we have in the /logs folder with our config:

fallback_access.log       fallback_error.log.2.gz  fallback_error.log.9.gz
fallback_access.log.1.gz  fallback_error.log.3.gz  redirection-host-1_access.log
fallback_access.log.2.gz  fallback_error.log.4.gz  redirection-host-1_access.log.1.gz
fallback_access.log.3.gz  fallback_error.log.5.gz  redirection-host-1_access.log.2.gz
fallback_access.log.4.gz  fallback_error.log.6.gz  redirection-host-1_access.log.3.gz
fallback_error.log        fallback_error.log.7.gz  redirection-host-1_access.log.4.gz
fallback_error.log.1.gz   fallback_error.log.8.gz  redirection-host-1_error.log
smilebasti commented 1 year ago

Ok. As i didn't plan it, it's currently not working without a reverse-proxy.

Give a me bit of time to release the redirection only.

Do you also need to monitor fallback?

cactusrent commented 1 year ago

Might be nice to have but realistically nothing that we'll need to monitor in this case. Thanks for the great work, I appreciate you looking into this!

smilebasti commented 1 year ago

Ok. I had a look at that file and it's to much useless information to display something interesting. As there is no use case currently i am not planning to implement it.

Tomorrow i'm planning to release (v2.2.1) the redirection-only function but with an additional feature. An ip-exclusion list for ip's from Monitoring Service's.

Glad to help

smilebasti commented 1 year ago

With the latest image you can set the REDIRECTION_LOGS to ONLY. This now only logs redirections which should fix your problem.

Let me know if it's not working as intended :)