问题描述
EFK日志收集系统,通过td-agent(Fluentd组件)收集nginx日志过程中,报无权限读取错误,如下:
2019-06-05 18:13:35.491689862 +0800 fluent.error: {"message":"Permission denied @ rb_sysopen - /var/log/nginx/access.log"}
解决方法
修改nginx日志生成的权限,修改/etc/logrotate.d/nginx 如下:
/var/log/nginx/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 644 nginx adm
sharedscripts
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}
重启nginx生效
原文链接:EFK收集nginx日志无法读取问题,转载请注明来源!