默認情況下,nginx將緩衝區刷新到access_log的頻率如何?我Nginx access_log默認刷新時間
access_log path [format [buffer=size [flush=time]] [if=condition]];
默認情況下,nginx將緩衝區刷新到access_log的頻率如何?我Nginx access_log默認刷新時間
access_log path [format [buffer=size [flush=time]] [if=condition]];
做了一些研究這一點,據我可以告訴nginx的不沖水緩衝區在所有如果你不這樣做:
在手動沒有信息,只安裝語法指定flush參數。 (或者如果是這樣,則超過20分鐘。)
唯一的例外是如果您重新啓動服務器,日誌在重新啓動之前被刷新。
因此,如果您指定緩衝區,則應確保指定刷新時間。
從nginx的文檔[1]:
When buffering is enabled, the data will be written to the file:
- if the next log line does not fit into the buffer;
- if the buffered data is older than specified by the flush parameter (1.3.10, 1.2.7);
- when a worker process is re-opening log files or is shutting down.
當然,如果你不指定flush
參數第二個條件不能成爲現實。
[1] http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
默認情況下,nginx不使用緩衝區。 –