日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

Nginx的error_log和Access_log分析 nginx access log( 四 )


ngx_int_t
ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
ngx_open_file_info_t *of, ngx_pool_t *pool)
{
time_t now;
uint32_t hash;
ngx_int_t rc;
ngx_file_info_t fi;
ngx_pool_cleanup_t *cln;
ngx_cached_open_file_t *file;
ngx_pool_cleanup_file_t *clnf;
ngx_open_file_cache_cleanup_t *ofcln;
of->fd = NGX_INVALID_FILE;
of->err = 0;
//配置open_log_file_cache off的話,cache為空
if (cache == NULL) {
......
//添加一個(gè)cleanup
cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t));
if (cln == NULL) {
return NGX_ERROR;
}
//打開日志文件,獲得fd rc = ngx_open_and_stat_file(name, of, pool->log);
rc = ngx_open_and_stat_file(name, of, pool->log);
//打開日志文件成功
if (rc == NGX_OK && !of->is_dir) {
//添加cleanup回調(diào),在銷毀內(nèi)存池的時(shí)候調(diào)用ngx_pool_cleanup_file,函數(shù)內(nèi)采用了close關(guān)閉fd
cln->handler = ngx_pool_cleanup_file;
clnf = cln->data;
【Nginx的error_log和Access_log分析 nginx access log】clnf->fd = of->fd;
clnf->name = name->data;
clnf->log = pool->log;
}
return rc;
}
......
}
2)如果配置open_file_log_cache的話,支持四種參數(shù):
max = N [ inactive = time ] [ min_uses = N ] [ valid = time ]
max 最大緩存文件描述符數(shù)量
inactive 在多少時(shí)間內(nèi)不活動(dòng),就會(huì)被刪除
min_uses 必須在 inactive時(shí)間內(nèi)活動(dòng)N次,才會(huì)被緩存
valid 檢查inactive的時(shí)間 。
具體的緩存文件fd的來龍去脈值得用一篇文章來詳細(xì)描述,在這里就暫且不說了,希望最近有時(shí)間整理出來 。
The End

推薦閱讀