mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 14:02:48 +00:00
feat: add support for log aggregators
This commit is contained in:
32
fixtures/logFormatters.template
Normal file
32
fixtures/logFormatters.template
Normal file
@@ -0,0 +1,32 @@
|
||||
map $time_iso8601 $time_iso8601_dateTime {
|
||||
~([^+]+) $1;
|
||||
}
|
||||
map $time_iso8601 $time_iso8601_TZ {
|
||||
~\+([0-9:]+)$ $1;
|
||||
}
|
||||
map $msec $millisec {
|
||||
~\.([0-9]+)$ $1;
|
||||
}
|
||||
|
||||
log_format json escape=json '{ "nginx_timestamp": "$time_iso8601_dateTime.$millisec+$time_iso8601_TZ", '
|
||||
'"remote_addr": "$remote_addr", '
|
||||
'"connection": "$connection", '
|
||||
'"connection_requests": $connection_requests, '
|
||||
'"pipe": "$pipe", '
|
||||
'"body_bytes_sent": $body_bytes_sent, '
|
||||
'"request_length": $request_length, '
|
||||
'"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", '
|
||||
'"http_version": "$server_protocol", '
|
||||
'"remote_user": "$remote_user", '
|
||||
'"http_x_forwarded_proto": "$http_x_forwarded_proto", '
|
||||
'"upstream_response_time": "$upstream_response_time", '
|
||||
'"nginx_access": true }';
|
||||
@@ -5,9 +5,10 @@ map $status $omitOKs {
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
access_log /dev/stdout combined if=$omitOKs;
|
||||
error_log stderr;
|
||||
access_log /dev/stdout {{{ logFormat }}} if=$omitOKs;
|
||||
location /metrics {
|
||||
vhost_traffic_status_display;
|
||||
vhost_traffic_status_display_format prometheus;
|
||||
vhost_traffic_status_display;
|
||||
vhost_traffic_status_display_format prometheus;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user