Last active
July 30, 2018 16:50
-
-
Save aursu/f3ba6fab96e7e65e6c161c1477e765b4 to your computer and use it in GitHub Desktop.
GitLab Omnibus distribution | Nginx nginx.conf: include /etc/nginx/conf.d/99-nginx-logging.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log_format gitlab_access '$remote_addr - $remote_user [$time_local] "$request_method $filtered_request_uri $server_protocol" $status $body_bytes_sent "$filtered_http_referer" "$http_user_agent"'; | |
log_format gitlab_mattermost_access '$remote_addr - $remote_user [$time_local] "$request_method $filtered_request_uri $server_protocol" $status $body_bytes_sent "$filtered_http_referer" "$http_user_agent"'; | |
# Remove private_token from the request URI | |
# In: /foo?private_token=unfiltered&authenticity_token=unfiltered&rss_token=unfiltered&... | |
# Out: /foo?private_token=[FILTERED]&authenticity_token=unfiltered&rss_token=unfiltered&... | |
map $request_uri $temp_request_uri_1 { | |
default $request_uri; | |
~(?i)^(?<start>.*)(?<temp>[\?&]private[\-_]token)=[^&]*(?<rest>.*)$ "$start$temp=[FILTERED]$rest"; | |
} | |
# Remove authenticity_token from the request URI | |
# In: /foo?private_token=[FILTERED]&authenticity_token=unfiltered&rss_token=unfiltered&... | |
# Out: /foo?private_token=[FILTERED]&authenticity_token=[FILTERED]&rss_token=unfiltered&... | |
map $temp_request_uri_1 $temp_request_uri_2 { | |
default $temp_request_uri_1; | |
~(?i)^(?<start>.*)(?<temp>[\?&]authenticity[\-_]token)=[^&]*(?<rest>.*)$ "$start$temp=[FILTERED]$rest"; | |
} | |
# Remove rss_token from the request URI | |
# In: /foo?private_token=[FILTERED]&authenticity_token=[FILTERED]&rss_token=unfiltered&... | |
# Out: /foo?private_token=[FILTERED]&authenticity_token=[FILTERED]&rss_token=[FILTERED]&... | |
map $temp_request_uri_2 $filtered_request_uri { | |
default $temp_request_uri_2; | |
~(?i)^(?<start>.*)(?<temp>[\?&]rss[\-_]token)=[^&]*(?<rest>.*)$ "$start$temp=[FILTERED]$rest"; | |
} | |
# A version of the referer without the query string | |
map $http_referer $filtered_http_referer { | |
default $http_referer; | |
~^(?<temp>.*)\? $temp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment