mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-18 16:58:27 -04:00
Update variable
Now log_format uses the same variable as geoip2.conf does
This commit is contained in:
@@ -51,23 +51,21 @@ The InfluxDB database will be created automatically with the name you choose.
|
|||||||
|
|
||||||
## Sending Nginx log metrics
|
## Sending Nginx log metrics
|
||||||
|
|
||||||
1. Add the following to the http block in your `nginx.conf`file:
|
1. Uncomment the Geoip2 config in `nginx.conf`
|
||||||
|
|
||||||
|
2. Add the following to the http block in your `nginx.conf`file:
|
||||||
|
|
||||||
```nginx
|
```nginx
|
||||||
geoip2 /config/geoip2db/GeoLite2-City.mmdb {
|
|
||||||
auto_reload 5m;
|
|
||||||
$geoip2_data_country_code country iso_code;
|
|
||||||
$geoip2_data_city_name city names en;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_format geoip2influx '$remote_addr - $remote_user [$time_local]'
|
log_format geoip2influx '$remote_addr - $remote_user [$time_local]'
|
||||||
'"$request" $status $body_bytes_sent'
|
'"$request" $status $body_bytes_sent'
|
||||||
'"$http_referer" $host "$http_user_agent"'
|
'"$http_referer" $host "$http_user_agent"'
|
||||||
'"$request_time" "$upstream_connect_time"'
|
'"$request_time" "$upstream_connect_time"'
|
||||||
'"$geoip2_data_city_name" "$geoip2_data_country_code"';
|
'"$geoip2_data_city_name" "$geoip2_data_country_iso_code"';
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Set the access log use the `geoip2influx` log format.
|
3. Set the access log use the `geoip2influx` log format.
|
||||||
|
|
||||||
|
Note: The log_format block must be above the access_log context.
|
||||||
```nginx
|
```nginx
|
||||||
access_log /config/log/nginx/access.log geoip2influx;
|
access_log /config/log/nginx/access.log geoip2influx;
|
||||||
```
|
```
|
||||||
@@ -86,4 +84,4 @@ As nginx can have multiple `access log` directives in a block, just add another
|
|||||||
```
|
```
|
||||||
This will log the same lines to both files.
|
This will log the same lines to both files.
|
||||||
|
|
||||||
Then use the `/config/log/nginx/access.log` file in the `NGINX_LOG_PATH` variable.
|
Then use the `/config/log/nginx/access.log` file in the `NGINX_LOG_PATH` variable.
|
||||||
|
|||||||
Reference in New Issue
Block a user