43

When you turn on the nginx rewrite log with rewrite_log on;, where does the system actually log that info? It doesn't seem to be in the documentation, and a decent search through google doesn't turn anything up.

I have also tried enabling and looking in both the access and error logs. No luck.

kenny
  • 3,439
  • 3
  • 26
  • 31

2 Answers2

64

If rewrite_log on; is used then the rewrite information will be logged to error_log at notice level. There is no separate log file.

Moritz Bunkus
  • 11,592
  • 3
  • 37
  • 49
  • 6
    to log rewrites at a specific level you can specify the level by defining: `error_log logs/error.log info` – Joe B Jun 20 '14 at 02:20
15

by default turning "rewrite_log on;" affects only if your config file "error_log logs/error.log notice;" already marks which non-default event levels do you need to be logged.

"Setting a certain log level will cause all messages of the specified and more severe log levels to be logged."

So, first "error_log logs/error.log notice;" then "rewrite_log on;" and error.log starts receiving rewriting logging

http://nginx.org/en/docs/ngx_core_module.html#error_log http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite

avs099
  • 10,937
  • 6
  • 60
  • 110
rustem.russia
  • 575
  • 5
  • 6