JoaMika
JoaMika

Reputation: 1827

nginx: [emerg] unknown log format

I am trying to exclude pingdom from appearing on my nginx access log however getting error:

nginx: [emerg] unknown log format "if=$excluded_ua" in /etc/nginx/nginx.conf:55
nginx: configuration file /etc/nginx/nginx.conf test failed

In the config I am adding:

http {
...

  map $http_user_agent $excluded_ua {
         pingdom  0;
         ~Preload 0;
         default 1;
     }

        access_log /var/log/nginx/access.log combined if=$excluded_ua;

...
}

After correcting for the error, I am still seeing the Pingdom entries in my access file.

94.247.174.83 - - [26/Oct/2017:22:02:56 +0100] "GET / HTTP/1.1" 200 14832 "-" "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)"

Upvotes: 1

Views: 10040

Answers (1)

Hel
Hel

Reputation: 225

You may need to include a log_format. The default one is "combined". Can you try access_log /var/log/nginx/access.log combined if=$excluded_ua;?

http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log

Upvotes: 5

Related Questions