Collectd Permission denied to Log File

collectdlogging

I have collectd running and I start it as root with:

service collectd start

However, I am not able to see the logs. I get the following when I run: service collectd status:

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

The permissions on the file system are as follows:

[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

I created the /var/log/collectd folder and /var/log/collectd/collectd.log file manually while trying t troubleshoot this problem.

The collectd configuration is as follows:

#LoadPlugin syslog
LoadPlugin "logfile"
#LoadPlugin log_logstash

<Plugin "logfile">
    LogLevel "info"
    File "/var/log/collectd/collectd.log"
    Timestamp true
    PrintSeverity false
</Plugin>

What am I missing? How can I get collectd to stop complaining about permissions and log properly?

Best Answer

Most likely it's SElinux. What does getenforce return?

Related Topic