fluentd

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


Here's my td-agent.conf file

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

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

But when I try to start the server using

sudo /etc/init.d/td-agent start

it gives the following error:

'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"

Can someone explain what's wrong?


Solution

  • If you installed td-agent v2, it creates its own user and group called td-agent. I believe that when you run the td-agent service, it switches to this user and hence it expects the directory to have write permissions for this user. I faced the same issue and did something like: (Use sudo if needed for below commands.)

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

    and update your section to:

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