diff options
author | Boss Marco <bossm8@bfh.ch> | 2022-06-08 15:26:41 +0200 |
---|---|---|
committer | Boss Marco <bossm8@bfh.ch> | 2022-06-08 15:26:41 +0200 |
commit | bd3955b8c05844bd4eaf0d61eaadb500a6282942 (patch) | |
tree | db261659328025fd68b95b8ec613d85bed195631 | |
parent | 964dcdd46192a18823b1a7d927a58c5aad7e110e (diff) | |
download | grid5k-bd3955b8c05844bd4eaf0d61eaadb500a6282942.tar.gz grid5k-bd3955b8c05844bd4eaf0d61eaadb500a6282942.tar.bz2 grid5k-bd3955b8c05844bd4eaf0d61eaadb500a6282942.zip |
tets nginx local logs
-rw-r--r-- | configs/etc/monitor/promtail-nginx.yaml | 87 | ||||
-rw-r--r-- | configs/etc/nginx/sites-available/exchange | 2 | ||||
-rw-r--r-- | configs/etc/rsyslog.conf | 94 |
3 files changed, 182 insertions, 1 deletions
diff --git a/configs/etc/monitor/promtail-nginx.yaml b/configs/etc/monitor/promtail-nginx.yaml new file mode 100644 index 0000000..812801d --- /dev/null +++ b/configs/etc/monitor/promtail-nginx.yaml @@ -0,0 +1,87 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://monitor.perf.taler:80/loki/api/v1/push + +scrape_configs: + +- job_name: nginx + static_configs: + - targets: + - localhost + labels: + job: nginx + __path__: /var/log/nginx/*log + relabel_configs: + - source_labels: [__syslog_message_app_name] + target_label: app + pipeline_stages: + - match: + selector: '{job="proxy"}' + stages: + - regex: + expression: 'uri=/(?P<ep>[a-zA-Z]+)(?:/\w+)?(?:/(?P<act>[a-zA-Z-]+))? s=(?P<status>\d{3}).*urt=(?P<urt>\d+\.\d+|-) rt=(?P<response_time>\d+\.\d+) rl=(?P<request_length>\d+) bs=(?P<bytes_sent>\d+)' + - template: + source: endpoint + template: '{{ printf "%s-%s" .ep .act | trimSuffix "-" }}' + - template: + source: upstream_response_time + template: '{{ .urt | replace "-" "0" }}' + - labels: + endpoint: + status: + - metrics: + total_requests: + prefix: 'taler_requests_' + type: Counter + description: "Total Requests" + config: + match_all: true + action: inc + # Used to calculate 'over_time' statistics + response_time: + prefix: 'taler_requests_' + type: Gauge + description: "Time taken for Nginx to respond" + source: response_time + max_idle_duration: 24h + config: + action: set + # https://www.robustperception.io/how-does-a-prometheus-histogram-work + request_length_hist: + prefix: 'taler_requests_' + type: Histogram + description: "Request Length reported from Nginx" + source: request_length + max_idle_duration: 24h + config: + buckets: [1,10,50,100,200,500,1000,2000,5000] + bytes_sent_hist: + prefix: 'taler_requests_' + type: Histogram + description: "Number of bytes sent, reported from Nginx" + source: bytes_sent + max_idle_duration: 24h + config: + buckets: [1,10,50,100,200,500,1000,2000,5000] + response_time_hist: + prefix: 'taler_requests_' + type: Histogram + description: "Time taken for Nginx to respond" + source: response_time + max_idle_duration: 24h + config: + buckets: [0.001,0.0025,0.005,0.010,0.025,0.050,0.1,0.25,0.5,1,2,5] + upstream_response_time_hist: + prefix: 'taler_requests_' + type: Histogram + description: "Time taken for the Exchange to respond to Nginx" + source: upstream_response_time + max_idle_duration: 24h + config: + buckets: [0.001,0.0025,0.005,0.010,0.025,0.050,0.1,0.25,0.5,1,2,5] diff --git a/configs/etc/nginx/sites-available/exchange b/configs/etc/nginx/sites-available/exchange index 82731dd..d7eb4bc 100644 --- a/configs/etc/nginx/sites-available/exchange +++ b/configs/etc/nginx/sites-available/exchange @@ -36,7 +36,7 @@ server { server_name <PROXY_DOMAIN_HERE>; - access_log syslog:server=localhost,facility=user,tag=taler_exchange_proxy,severity=info taler if=$log_line; + # access_log syslog:server=localhost,facility=user,tag=taler_exchange_proxy,severity=info taler if=$log_line; allow 172.16.0.0/12; deny all; diff --git a/configs/etc/rsyslog.conf b/configs/etc/rsyslog.conf new file mode 100644 index 0000000..6d873af --- /dev/null +++ b/configs/etc/rsyslog.conf @@ -0,0 +1,94 @@ +# /etc/rsyslog.conf configuration file for rsyslog +# +# For more information install rsyslog-doc and see +# /usr/share/doc/rsyslog-doc/html/configuration/index.html +# + +################# +#### MODULES #### +################# + +module(load="imuxsock" SysSock.RateLimit.Interval="0" SysSock.Annotate="on" SysSock.RateLimit.Burst="10000") # provides support for local system logging +module(load="imklog") # provides kernel logging support +#module(load="immark") # provides --MARK-- message capability + +# provides UDP syslog reception +module(load="imudp") +input(type="imudp" port="514") + +# provides TCP syslog reception +#module(load="imtcp") +#input(type="imtcp" port="514") + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat +$ActionQueueWorkerThreads 10 + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + + +############### +#### RULES #### +############### + +# +# First some standard log files. Log by facility. +# +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +mail.info -/var/log/mail.info +mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# +# Some "catch-all" log files. +# +*.=debug;\ + auth,authpriv.none;\ + mail.none -/var/log/debug +*.=info;*.=notice;*.=warn;\ + auth,authpriv.none;\ + cron,daemon.none;\ + mail.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg :omusrmsg:* + |