› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
sdjl
V2EX  ›  NGINX

Nginx 是否可以忽略部分错误日志?

  •  
  •   sdjl · Apr 26, 2020 · 3944 views
    This topic created in 2383 days ago, the information mentioned may be changed or developed.
    比如有这么一条错误日志:

    17 2020/04/25 18:40:50 [error] 30912#30912: *925989 open().........

    是否可以根据 30912 忽略掉类似的错误日志?
    8 replies  •  2020-05-23 00:27:25 +08:00
    defunct9
    defunct9
    Apr 26, 2020 via iPhone
    1
    本身不就是忽略么,只是报在 error 日志中了
    sdjl
    sdjl
    OP
    Apr 26, 2020
    2
    @defunct9 就是希望不要写到日志文件中
    Fris
    Fris
    Apr 26, 2020 via iPhone
    3
    自己改源代码再编译?
    learningman
    learningman
    Apr 26, 2020
    4
    调错误级别
    tomato224
    tomato224
    Apr 27, 2020❤️1
    5
    如果是找不到资源, 设置 log_not_found off # 记录到 access_log
    使用 log_format + access_log 配置格式和位置
    # access_log logs/access.log mylogformat if=$loggable;
    再使用 map 定义过滤 $loggable

    如果错误日志的其他错误, 就需要三方模块了
    keepfun
    keepfun
    Apr 27, 2020
    6
    ngx_log_if 可以看下这个 不过应该需要重新编译 nginx
    sdjl
    sdjl
    OP
    Apr 28, 2020
    7
    @tomato224 好的,谢谢,看来是不行了
    hstv
    hstv
    May 23, 2020
    8
    写个脚本二次处理不就可以了了。还可以按天分割日志。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1549 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 18:10 · PVG 02:10 · LAX 10:10 · JFK 13:10
    ♥ Do have faith in what you're doing.