xirixiz / dsmr-reader-docker

DSMR Reader in Docker.
https://hub.docker.com/r/xirixiz/dsmr-reader-docker
113 stars 33 forks source link

Disable access logs #304

Closed rogierlommers closed 1 year ago

rogierlommers commented 1 year ago

Request

Hey! Still using your docker-compose file. Love it! I have one question though: I see a lot of access logs. Is it somehow possible to disable them?

dsmr-app      | 127.0.0.1 - - [07/Dec/2022:21:36:14 +0100] "GET /about HTTP/1.1" 200 13006 "-" "curl/7.83.1" "-"
dsmr-app      | 127.0.0.1 - - [07/Dec/2022:21:36:29 +0100] "GET /about HTTP/1.1" 200 13006 "-" "curl/7.83.1" "-"
dsmr-app      | 127.0.0.1 - - [07/Dec/2022:21:36:44 +0100] "GET /about HTTP/1.1" 200 13006 "-" "curl/7.83.1" "-"

I guess they come from this, right? Simply disabling the healthchecks would fix them.

But what about the "normal" access logs? I'm not interested in them, since I get access logs from my reverse proxy. Is it possible to disable access logs in general?

xirixiz commented 1 year ago

Hi Rogier, good to hear you're still enjoying DSMR Reader in Docker!

It's possible to disable the healthcheck via the docker-compose file:

healthcheck:
  disable: true

Disabling the nginx access.log isn't possible currently, but maybe I`ll add it in a future release. Ofcourse it's always possible to map a nginx config file to the Docker container that contains settings according your wishes :).

rogierlommers commented 1 year ago

Hey @xirixiz , not sure if you accept merge requests. But here you have one: https://github.com/xirixiz/dsmr-reader-docker/pull/305

xirixiz commented 1 year ago

Ofcourse I do! I like contributions/PR's! Thanks!

Will take a look at it later Today.

xirixiz commented 1 year ago

Released!

rogierlommers commented 1 year ago

Released!

I see, thanks!

(starting docker pull)

rogierlommers commented 1 year ago

hmz.. it doesn't seem to work though:

root@dsmr_reader_docker:/app# cat /etc/nginx/conf.d/dsmr-webinterface.conf
upstream dsmr-webinterface {
    server unix:///tmp/gunicorn--dsmr_webinterface.socket fail_timeout=0;
}

server {
    listen      80;
    server_name _;  # No hostname available? Just use the default underscore here for wildcard matching.

    # Uncomment these lines below to force additional authentication on application access.
    # NOTE: Alter the IP-range '192.168.1.0/24' if you are using a different one (i.e.: 10.0.x.x)!
    # WARNING: Do not forget to generate a password first in '/etc/nginx/htpasswd' and then RELOAD nginx (TEST IT)!
##    satisfy    any;
##    allow      192.168.1.0/24;
##    deny       all;
##    auth_basic "Restricted application";
##    auth_basic_user_file /etc/nginx/htpasswd;

    location /static {
        alias /var/www/dsmrreader/static;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://dsmr-webinterface;
    }
}
rogierlommers commented 1 year ago

I would expect a line that says: access_log off

Can I somehow validate that this function has been executed?

xirixiz commented 1 year ago

The function hasn't been executed :). The function you created doesn't work unfortunatly.

-z should be -n .... fixing it now.

xirixiz commented 1 year ago

If you run docker logs -f dsmr you should see an echo passing by "Disabling NGINX access logs...".

xirixiz commented 1 year ago

New release ready. Seems to work.

[ INFO ] Disabling NGINX access logs...
rogierlommers commented 1 year ago

yup, just re-deployed and indeed it works. Thanks!