nginx - 将 nginx 日志发送到 syslog 和 stdout/stderr

标签 nginx stdout stderr nginx-config

默认情况下,我的 nginx服务器正在将日志绘制到 stdoutstderr .

我想将日志转发到我的 syslog 服务器,而且我已经成功地从 nginx.conf :

server {
  ...
  error_log syslog:server=localhost:5447,facility=local7,tag=nginx_client,severity=error;
  access_log syslog:server=localhost:5447,facility=local7,tag=nginx_client,severity=info;
  ...
}

如何将我的服务器配置为 还有将日志绘制到 stdoutstderr ?

最佳答案

块中有多个 error_log 和 access_log 条目

error_log syslog:server=localhost:5447,facility=local7,tag=nginx_client,severity=error;

access_log syslog:server=localhost:5447,facility=local7,tag=nginx_client,severity=info;

error_log stderr;
access_log /dev/stdout;

应该做的伎俩

关于nginx - 将 nginx 日志发送到 syslog 和 stdout/stderr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52984329/

相关文章:

mysql - 将 SSL 证书添加到 mysql docker 容器

SSL 终止 Nginx 入口 Controller

c - 从 C 中正在运行的进程的 stdout fd 读取

ruby - 将 stderr 重定向到 Logger 实例

无法通过 http 访问 nginx CentOS 7

angularjs - nginx、预渲染和 Angular 路由问题

c++ - 在 VC++ 中执行一个进程并返回它的标准输出

python - 为什么低于 0.25 的 time() 会跳过 Python 中的动画?

powershell - 将 stdout 和 stderr 捕获到文件,同时将它们保留在终端中

multithreading - stdin、stdout 和 stderr 是共享的吗?