Fluentd gives the error: Log file is not writable, when starting the server

Fluentd gives the error: Log file is not writable, when starting the server

这是我的 td-agent.conf 文件

<source>
 @type http  
 port 8888
</source>

<match whatever.access>
 @type file
 path /var/log/what.txt
</match>

但是当我尝试使用

启动服务器时
sudo /etc/init.d/td-agent start

它给出了以下错误:

'2016-02-01 10:45:49 +0530 [error]: fluent/supervisor.rb:359:rescue in >main_process: config error file="/etc/td-agent/td-agent.conf" error="out_file: >/var/log/what.txt.20160201_0.log is not writable"

谁能解释一下哪里出了问题?

我想当你尝试启动td-agent时,你没有访问/var/log/的权限,使用ls -l检查其权限模式并将其更改为chmod。 我也遇到了同样的问题,更改目录的访问权限后,td-agent可以启动了。

如果您安装了 td-agent v2,它会创建自己的用户和组 td-agent。我相信当您 运行 td-agent 服务时,它会切换到该用户,因此它希望该目录对该用户具有写权限。我遇到了同样的问题并做了类似的事情:(如果需要以下命令,请使用 sudo。)

mkdir /logs
chown td-agent:td-agent /logs

并将您的部分更新为:

<match whatever.access>
  @type file
  path /logs/what.txt
</match>