doutuo7609 2016-02-21 00:10
浏览 456
已采纳

php-fpm写巨大的日志文件

in /usr/local/nginx/logs/ I have a huge www.access.log file.

It grows undefinitely (last time I truncated it was 3.5 GB) with a new log entry every time a php script is called.

Every line looks like this:

- -  21/Feb/2016:00:59:09 +0100 "GET /index.php" 200 /absoulute-path/index.php 10,373 1280 96,40%

The file is written by php-fpm process

Browsing thru the various configuration files (nginx, php.ini....) I cannot find the directive to write logs to that file.

How can I disable it?

  • 写回答

3条回答 默认 最新

  • dqz7636 2016-02-21 02:02
    关注

    Given the format and the informations provided in the sample log entry posted in the question the huge log file has nothing (directly) to do with nginx nor with its configuration files, despite it's located in .../nginx/logs/

    That ....access.log file is written by php-fpm worker processes when a specific option is set into php-fpm's configuration file php-fpm.conf

    The file (on my server) is located into /etc/

    At some point in the configuration file there is:

    ; The access log file
    ; Default: not set
    ; access.log = /usr/local/nginx/logs/$pool.access.log
    

    By default that option is not set and should remain unset; as far as I know the log file it produces is used to test php-fpm proper operation.

    If the line is uncommented by removing the semicolon...

    ; The access log file
    ; Default: not set
    access.log = /usr/local/nginx/logs/$pool.access.log
    

    ...then a .access.log file prefixed with the pool name (www in the case exposed in the question) is generated. And it grows quickly as each time a php script is run due to a request a new log entry is appended.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看