Skip to content
Snippets Groups Projects
Commit 77d17fba authored by Kristian Klausen's avatar Kristian Klausen :tada:
Browse files

recording rule with upstream_cache_status

parent bcd551a5
No related branches found
No related tags found
No related merge requests found
......@@ -4,3 +4,5 @@ groups:
rules:
- record: nginx:requests:rate1m
expr: 'sum by (instance, server_protocol, ssl_protocol, ssl_cipher) (rate({job="nginx"}[1m] | json))'
- record: nginx:requests:rate1m
expr: 'sum by (instance, upstream_cache_status) (rate({job="nginx"}[1m] | json))'
......@@ -28,13 +28,14 @@ http {
'$remote_addr $host $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_time '
'$server_protocol $ssl_protocol $ssl_cipher';
'$server_protocol $ssl_protocol $ssl_cipher '
'$upstream_cache_status';
log_format reduced
'$host [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $server_protocol $ssl_protocol '
'$ssl_cipher';
'$ssl_cipher $upstream_cache_status';
log_format json_main escape=json
'{'
......@@ -53,6 +54,7 @@ http {
'"server_protocol":"$server_protocol",'
'"ssl_protocol":"$ssl_protocol",'
'"ssl_cipher":"$ssl_cipher",'
'"upstream_cache_status":"$upstream_cache_status",'
# This was added to keep every log line unique as Loki drops
# log line with the same timestamp and log text:
# https://grafana.com/docs/loki/latest/overview/#timestamp-ordering
......@@ -73,6 +75,7 @@ http {
'"server_protocol":"$server_protocol",'
'"ssl_protocol":"$ssl_protocol",'
'"ssl_cipher":"$ssl_cipher",'
'"upstream_cache_status":"$upstream_cache_status",'
# This was added to keep every log line unique as Loki drops
# log line with the same timestamp and log text:
# https://grafana.com/docs/loki/latest/overview/#timestamp-ordering
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment