Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an easy way to turn off logs for healthcheck paths? #106

Open
guyschlider opened this issue Aug 30, 2021 · 1 comment
Open

Is there an easy way to turn off logs for healthcheck paths? #106

guyschlider opened this issue Aug 30, 2021 · 1 comment

Comments

@guyschlider
Copy link

guyschlider commented Aug 30, 2021

Lets say I want to add a custom location {} directive to the nginx.conf without having a fully modified version of it,
What is the best practice for doing so?
location /health { access_log off; error_log /dev/stderr error; proxy_pass http://api; }
for example

@tony-garcia
Copy link

tony-garcia commented Mar 3, 2023

This is how I turned off logging for health check requests. (in my app, the health checks were hitting the URL /heathcheck/

map $request_uri $loggable {
  /healthcheck/ 0;
  default 1;
}

server {
...
  access_log  /var/log/nginx/access.log  main if=$loggable;
...
}

source: http://nginx.org/en/docs/http/ngx_http_log_module.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants