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

3

6

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?

Filterable answered 1/2, 2016 at 5:23 Comment(0)
S
8

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>
Seraphim answered 17/9, 2016 at 2:38 Comment(0)
S
3

I think when you try to start td-agent, you do not have permission to access /var/log/, using ls -l to check its permission mode and change it with chmod. I got the same problem, after change directory's access permission, td-agent can be started.

Sheppard answered 3/2, 2016 at 16:9 Comment(0)
S
0

i had to cd into my container's directory, and chmod 777 the /var/log directory. the safest alternative is to chown your user.

you need to have write permissions for your files (path, pos, etc.)

Spermine answered 30/7 at 11:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.