1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 02:14:48 +00:00

Add LOG_IP_VAR environment variable (Issue #22)

This commit is contained in:
CrazyMax 2019-04-13 02:47:24 +02:00
parent cd44876e09
commit 68d3c1030e
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,9 @@
# Changelog
## 1.50-RC4 (2019/04/13)
* Add `LOG_IP_VAR` environment variable (Issue #22)
## 1.50-RC3 (2019/04/07)
* Use python3 for snmp-scan (Issue #25)

View file

@ -50,6 +50,7 @@ It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/
* `OPCACHE_MEM_SIZE` : PHP OpCache memory consumption (default `128`)
* `REAL_IP_FROM` : Trusted addresses that are known to send correct replacement addresses (default `0.0.0.0/32`)
* `REAL_IP_HEADER` : Request header field whose value will be used to replace the client address (default `X-Forwarded-For`)
* `LOG_IP_VAR` : Use another variable to retrieve the remote IP address in Nginx. If you use a reverse proxy you can set `http_x_forwarded_for` example. (default `remote_addr`)
#### (Distributed) Poller

View file

@ -14,7 +14,6 @@ events {
http {
include mime.types;
default_type application/octet-stream;
access_log /proc/1/fd/1;
aio threads;
sendfile on;
@ -33,6 +32,12 @@ http {
set_real_ip_from @REAL_IP_FROM@;
real_ip_header @REAL_IP_HEADER@;
# Log
log_format main '$@LOG_IP_VAR@ - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /proc/1/fd/1 main;
## Hide the Nginx version number
server_tokens off;

View file

@ -13,6 +13,7 @@ UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE:-16M}
OPCACHE_MEM_SIZE=${OPCACHE_MEM_SIZE:-128}
REAL_IP_FROM=${REAL_IP_FROM:-"0.0.0.0/32"}
REAL_IP_HEADER=${REAL_IP_HEADER:-"X-Forwarded-For"}
LOG_IP_VAR=${LOG_IP_VAR:-remote_addr}
MEMCACHED_PORT=${MEMCACHED_PORT:-11211}
RRDCACHED_PORT=${RRDCACHED_PORT:-42217}
@ -98,6 +99,7 @@ echo "Setting Nginx configuration..."
sed -e "s#@UPLOAD_MAX_SIZE@#$UPLOAD_MAX_SIZE#g" \
-e "s#@REAL_IP_FROM@#$REAL_IP_FROM#g" \
-e "s#@REAL_IP_HEADER@#$REAL_IP_HEADER#g" \
-e "s#@LOG_IP_VAR@#$LOG_IP_VAR#g" \
/tpls/etc/nginx/nginx.conf > /etc/nginx/nginx.conf
# SNMP

View file

@ -3,6 +3,7 @@ UPLOAD_MAX_SIZE=16M
OPCACHE_MEM_SIZE=128
REAL_IP_FROM=0.0.0.0/32
REAL_IP_HEADER=X-Forwarded-For
LOG_IP_VAR=http_x_forwarded_for
LIBRENMS_POLLER_THREADS=16
LIBRENMS_POLLER_INTERVAL=5