nginxloggingnginx-configerror-loglog-level

How to separate or filter nginx error log levels


as I understood in nginx I could specify an error log as warn , error , info , debug , ...

my problem is that I wanna have warn logs and error logs on separate files but as you know if I a specify a file for warn logs then It would include error logs too

so I will have a file containing only error log and another file containing both error log and warn log

but I wanna have a file just for errors and another just for warns

how can I separate them entirely?


Solution

  • In theory, you can achieve what you want by having error_log logging to syslog.

    Then create a "rule" in rsyslog configuration to forward different severities to different files.