Skip to content

Instantly share code, notes, and snippets.

@marcuswestin
Created July 29, 2015 03:38
Show Gist options
  • Save marcuswestin/49bb2176551675f3bc13 to your computer and use it in GitHub Desktop.
Save marcuswestin/49bb2176551675f3bc13 to your computer and use it in GitHub Desktop.
# Logging service
#################
log_format component_log '[$log_component $time_iso8601 $log_level] $request_body';
server {
listen 127.0.0.1:15000;
server_name localhost;
error_log logs/log-error.log;
access_log logs/log-access.log;
location = /log/api/alert {
set $log_component 'api'; set $log_level 'ALERT!!';
access_log logs/api-alert.log component_log;
proxy_pass http://127.0.0.1:15000/ok; # Required for $request_body
}
location = /log/api/monitor {
set $log_component 'api'; set $log_level 'MONITOR';
access_log logs/api-monitor.log component_log;
proxy_pass http://127.0.0.1:15000/ok; # Required for $request_body
}
location = /log/api/verbose {
set $log_component 'api'; set $log_level 'VERBOSE';
access_log logs/api-verbose.log component_log;
proxy_pass http://127.0.0.1:15000/ok; # Required for $request_body
}
location = /log/api/everything {
set $log_component 'api'; set $log_level 'EVRTHNG';
access_log logs/api-everything.log component_log;
proxy_pass http://127.0.0.1:15000/ok; # Required for $request_body
}
location ~ ^/ok {
return 200 "Hi";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment