我已经收集了运行,并以 root 身份启动它:
service collectd start
但是,我看不到日志。我运行时得到以下信息:服务收集状态:
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
logfile plugin: fopen (/var/log/collectd/collectd.log) failed: Permission denied
文件系统的权限如下:
[root@avocado]# ls -la /var/log/collectd/
total 8
drwxrwxrwx. 2 root root 4096 Aug 16 06:07 .
drwxr-xr-x. 20 root root 4096 Aug 16 06:00 ..
-rwxrwxrwx. 1 root root 0 Aug 16 06:07 collectd.log
我在尝试解决此问题时手动创建了 /var/log/collectd 文件夹和 /var/log/collectd/collectd.log 文件。
collectd配置如下:
#LoadPlugin syslog
LoadPlugin "logfile"
#LoadPlugin log_logstash
<Plugin "logfile">
LogLevel "info"
File "/var/log/collectd/collectd.log"
Timestamp true
PrintSeverity false
</Plugin>
我错过了什么?我怎样才能收集到停止抱怨权限并正确记录?
很可能是SElinux。getenforce 返回什么?
对我来说,它是 selinux,这修复了它:
然后