improve nginx logging
This commit is contained in:
parent
e1614619fa
commit
860baf6203
3 changed files with 29 additions and 19 deletions
|
@ -1,6 +1,7 @@
|
||||||
{ lib, config, pkgs, ... }: {
|
{ lib, config, pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
|
|
||||||
|
../../system/all/nginx.nix
|
||||||
../../system/all/borg-jobs.nix
|
../../system/all/borg-jobs.nix
|
||||||
../../system/all/defaults.nix
|
../../system/all/defaults.nix
|
||||||
../../system/all/syncthing.nix
|
../../system/all/syncthing.nix
|
||||||
|
|
|
@ -108,23 +108,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# "stable-diffusion.ingolf-wagner.de" = {
|
|
||||||
# forceSSL = true;
|
|
||||||
# enableACME = true;
|
|
||||||
# extraConfig = error.extraConfig;
|
|
||||||
# root = "/srv/www/stable-diffusion";
|
|
||||||
# locations = {
|
|
||||||
# "/model-v1-4.ckpt" = {
|
|
||||||
# basicAuthFile = "${private_assets}/stable-diffusion-htpasswd";
|
|
||||||
# tryFiles = "/stable-diffusion-v-1-4-original/sd-v1-4.ckpt =404";
|
|
||||||
# };
|
|
||||||
# #"/model-v1-3.ckpt" = {
|
|
||||||
# # basicAuthFile = "${private_assets}/stable-diffusion-htpasswd";
|
|
||||||
# # tryFiles = "stable-diffusion-v-1-3-original/sd-v1-3.ckpt";
|
|
||||||
# #};
|
|
||||||
# } // error.locations;
|
|
||||||
# };
|
|
||||||
|
|
||||||
"travel.ingolf-wagner.de" = {
|
"travel.ingolf-wagner.de" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
access_log_sink = "workhorse.private:12304";
|
access_log_sink = "<server>:<port>";
|
||||||
error_log_sink = "workhorse.private:12305";
|
error_log_sink = "<server>:<port>";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -16,6 +16,32 @@ in
|
||||||
recommendedProxySettings = lib.mkDefault true;
|
recommendedProxySettings = lib.mkDefault true;
|
||||||
recommendedTlsSettings = lib.mkDefault true;
|
recommendedTlsSettings = lib.mkDefault true;
|
||||||
|
|
||||||
|
# for loki logging
|
||||||
|
commonHttpConfig = ''
|
||||||
|
log_format logfmt escape=json 'timestamp=$time_iso8601 '
|
||||||
|
'facility=nginx '
|
||||||
|
'src_addr=$remote_addr '
|
||||||
|
'body_bytes_sent=$body_bytes_sent '
|
||||||
|
'request_time=$request_time '
|
||||||
|
'response_status=$status '
|
||||||
|
'request="$request" '
|
||||||
|
'request_method="$request_method" '
|
||||||
|
'host="$host" '
|
||||||
|
'upstream_cache_status="$upstream_cache_status" '
|
||||||
|
'upstream_addr="$upstream_addr" '
|
||||||
|
'http_x_forwarded_for="$http_x_forwarded_for" '
|
||||||
|
'http_referrer="$http_referer" '
|
||||||
|
'http_user_agent="$http_user_agent"';
|
||||||
|
|
||||||
|
# log to local journald
|
||||||
|
access_log syslog:server=unix:/dev/log logfmt;
|
||||||
|
|
||||||
|
# to send logs somewhere
|
||||||
|
#access_log syslog:server=${access_log_sink} logfmt;
|
||||||
|
#error_log syslog:server=${error_log_sink};
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
# for graylog logging
|
# for graylog logging
|
||||||
#commonHttpConfig = ''
|
#commonHttpConfig = ''
|
||||||
# log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", '
|
# log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", '
|
||||||
|
|
Loading…
Reference in a new issue