Z
Z
zeribaveg2016-11-14 03:03:42
Nginx
zeribaveg, 2016-11-14 03:03:42

How to leave only logs with status 200 in access.log, and everything else in error.log?

I use the ispmanager 5 panel. (ubuntu 14 + nginx+php-fpm, php 5). I recently installed the same ispmanager 5 + ubuntu 16 and php 7 on a new server. The following problem emerged: for some reason, logs for accessing sites are now written in access.log in most cases.
Let me explain. If earlier on the old server, for example, 401 errors were always written to error.log, now such errors are written to access.log. How to change it? And it is desirable to leave only a certain status in access.log (for example, 200, 301, 302, etc.)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zada, 2016-11-14
@zeribaveg

This is not an answer to the question.
Don't do what you want.
The Error log exists to clone errors that you need to fix and allow for reoccurrence.
The Access log is designed to log all server responses that worked WITHOUT errors. 404, 301/302, etc are valid responses from the point of view of the web server and do not need to be classified as erroneous.
You'd be better off using a logging tool to work with access.log and filter only the messages you want. There are tools from grep to ELK.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question