nginx映像正在捕获日志,这些日志正在使用符号链接转发到/dev/stdout和/dev/stderror,这将呈现给Rancher UI日志控制台,用于此部署。
我需要转发到一个圆角舱,它已经成功地从其他豆荚中收集了日志。
任何给予的帮助都将不胜感激。
######################## nginx和location ########################
/var/log/nginx # ls -hal共计0 drwxr-xr-x2根41,2016年10月18日。2016年10月19日.access.log -> /dev/stdout lrwxrwxrwx 1根,2016年10月11日error.log -> /dev/stderr
######################## nginx conf ########################
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
} 尝试了对配置文件进行不同的更改,但无法找到将日志转发到流畅荚的方法,后者已经在从同一个命名空间中的其他部署中收集日志。
发布于 2022-11-13 09:24:49
尝试使用不同的nginx.conf,但仍然看不到将日志转发给fluentd/mongodb
其他的豆荚没有问题,可以看到它们收藏的日志,只有这个nginx荚不是转发的,其他的不是nginx代理。
任何提供的帮助都将非常感谢,如下面的nginx和fluentd配置文件所示
我可以在nginx.namespace.svc和fluentd.namespace.svc之间切换
<pre><code>
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main escape=json
'{'
'"time_local":"$time_local",'
'"remote_addr":"$remote_addr",'
'"remote_user":"$remote_user",'
'"request":"$request",'
'"status": "$status",'
'"body_bytes_sent":"$body_bytes_sent",'
'"http_referrer":"$http_referer",'
'"http_user_agent":"$http_user_agent",'
'"request_time":"$request_time"'
'}';
access_log syslog:server=fluentd.namespace.svc:24224 main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
</code></pre>
<pre><code>
<source>
@type forward
@id inputDocker
@label @DOCKER
port 24224
bind 0.0.0.0
</source>
<label @DOCKER>
<match **>
# plugin type
@type mongo
# mongo db connection string
connection_string mongodb://logging:password@mongodb.namespace.svc:27017/logs
# mongodb db + collection
collection docker
# interval
<buffer>
flush_interval 10s
</buffer>
# make sure to include the time key
<inject>
time_key time
</inject>
</match>
</label>
</code></pre>https://stackoverflow.com/questions/74405808
复制相似问题