m
This commit is contained in:
65
volumes/snippets/registry-transfer-logging.conf
Normal file
65
volumes/snippets/registry-transfer-logging.conf
Normal file
@@ -0,0 +1,65 @@
|
||||
# JSON log format for transfer-only lines
|
||||
log_format registry_json escape=json
|
||||
'{'
|
||||
'"timestamp":"$time_iso8601",'
|
||||
'"remote_address":"$remote_addr",'
|
||||
'"remote_user":"$remote_user",'
|
||||
'"request_id":"$request_id",'
|
||||
'"method":"$request_method",'
|
||||
'"path":"$uri",'
|
||||
'"query_string":"$args",'
|
||||
'"http_version":"$server_protocol",'
|
||||
'"status":$status,'
|
||||
'"bytes_sent":$bytes_sent,'
|
||||
'"body_bytes_sent":$body_bytes_sent,'
|
||||
'"request_length":$request_length,'
|
||||
'"request_time":$request_time,'
|
||||
'"upstream_status":"$upstream_status",'
|
||||
'"upstream_time":"$upstream_response_time",'
|
||||
'"referer":"$http_referer",'
|
||||
'"user_agent":"$http_user_agent",'
|
||||
'"x_forwarded_for":"$http_x_forwarded_for",'
|
||||
'"range":"$http_range",'
|
||||
'"docker_content_digest":"$sent_http_docker_content_digest",'
|
||||
'"upstream_range":"$upstream_http_range",'
|
||||
'"docker_upload_uuid":"$upstream_http_docker_upload_uuid"'
|
||||
'}';
|
||||
|
||||
map $body_bytes_sent $has_body_bytes_sent {
|
||||
default 0;
|
||||
~^[1-9][0-9]*$ 1;
|
||||
}
|
||||
|
||||
map "$request_method$uri" $is_blob_get {
|
||||
default 0;
|
||||
~^GET/v2/.+/blobs/sha256:[a-f0-9]+$ 1;
|
||||
}
|
||||
|
||||
map "$is_blob_get$has_body_bytes_sent" $is_pull_transfer {
|
||||
default 0;
|
||||
~^11$ 1;
|
||||
}
|
||||
|
||||
map $upstream_http_range $has_upstream_range {
|
||||
default 0;
|
||||
~^[0-9]+-[0-9]+$ 1;
|
||||
}
|
||||
|
||||
map "$request_method$uri" $is_upload_patch {
|
||||
default 0;
|
||||
~^PATCH/v2/.+/blobs/uploads/[a-f0-9-]+$ 1;
|
||||
}
|
||||
|
||||
map "$is_upload_patch$has_upstream_range" $is_push_transfer {
|
||||
default 0;
|
||||
~^11$ 1;
|
||||
}
|
||||
|
||||
map "$is_pull_transfer$is_push_transfer" $is_transfer_loggable {
|
||||
default 0;
|
||||
~1 1;
|
||||
}
|
||||
|
||||
map $upstream_http_docker_distribution_api_version $docker_distribution_api_version {
|
||||
'' 'registry/2.0';
|
||||
}
|
||||
Reference in New Issue
Block a user