Disable logging on nginx pod for ELB-HealthChecker/2.0 User-Agent
I am sending EKS logs to ELK stack. It is working great, but AWS ELB health check creates lots of logs and does not let me track other events properly on Kibana dashboard.
My images are based on nginx. Here is nginx configuration to disable nginx logging for ELB-HealthChecker/2.0
First, create a map for user agent and set new access_log
in related config parts then create new docker image. I updated /etc/nginx/conf.d/default.conf
in this example. Because I am using following statement in Dockerfile. You should update the correct nginx conf file based on your Dockerfile configuration.
COPY nginx.conf /etc/nginx/conf.d/default.conf
#Disable logging for ELB healthcheck. It creates lots of noise on logging platform# https://docs.nginx.com/nginx/admin-guide/monitoring/logging/#enabling-conditional-loggingmap $http_user_agent $ignore_ua {
default 1;
"ELB-HealthChecker/2.0" 0;
}server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
access_log /var/log/nginx/access.log combined if=$ignore_ua;
}
Ismail YENIGUL
Devops Engineer