0

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?

Klaus
  • 181
  • 1
  • 6

3 Answers3

2

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

Mugurel
  • 903
  • 1
  • 9
  • 17
0

For me it was selinux, and this fixed it:

setenforce 0
chicks
  • 3,793
  • 10
  • 27
  • 36
  • To make `setenforce 0` persistent over a reboot, edit `/etc/selinux/config`: `SELINUX=permissive` – Gerd Feb 15 '18 at 14:05
  • What does this command do? Why will it help the OP? I think it would be best if you could [edit] your answer to include a bit more explanation. – grooveplex Feb 15 '18 at 16:56
0
yum install policycoreutils-python

then

semanage permissive -a collectd_t
Sahir
  • 1