A
A
Alexander Pyatnitsin2016-03-10 15:55:21
linux
Alexander Pyatnitsin, 2016-03-10 15:55:21

How is an entry created in the logs that there is not enough space to write the log?

Literally today, on one of the projects, I came across such an entry in the error_log of nginx

2016/03/10 01:33:20 [alert] 343#0: *43891688 write() to "/u01/nginx_log/access_conf.log" failed (28: No space left on device) while logging request
....
2016/03/10 01:33:20 [alert] 334#0: *45145930 write() to "/u01/nginx_log/access_all.log" failed (28: No space left on device) while logging r

That is, it is clear that the disk space ran out while nginx wrote the last error entry (the text was copied completely, only the first beech of the word request is present, the rest did not fit on the disk).
The question arose, how is logging regulated in nginx? why didn't he also create a "piece" entry in the access log (where he tried to write initially), but created a "piece" in the error log? The log files are in the same folder (that is, the case when errors are written to another partition, where there was space at that moment, is excluded).
I didn't find anything in the documentation about this.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Zhivotnev, 2016-03-10
@jafte

access_log is buffered, error_log is not, it is immediately flushed to disk.
nginx did not find a place to drop a few kilobytes of the buffer, but the lines got into the error_log.

D
Dimonchik, 2016-03-10
@dimonchik2013

it just happened/coincidentally
, well, probably, the error log has priority, but at a particular point in time, the process cannot know if there is a place, or it has already ended, in this case, the error log was lucky, at least part of it got in
4a6036995a3049aa91d1994e0ff9cc10.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question