简体   繁体   中英

Apache Flume /var/log/flume-ng/flume.log (Permission denied)

I am trying to read a log file from /home/cloudera/Documents/flume/ and write it to hdfs using apache flume . I used the following command to create flumeLogTest folder in hdfs :

sudo -u hdfs hadoop fs -mkdir flumeLogTest
sudo -u hdfs hadoop fs -chown flume:flume flumeLogTest

My config file is :

agent.sources = src
agent.channels = ch
agent.sinks = snk

agent.sources.src.type = exec
agent.sources.src.command = tail -f Documents/flume/vmware-0.log
agent.sources.src.channels = ch

agent.sinks.snk.channel = ch
agent.sinks.snk.type = hdfs
agent.sinks.snk.hdfs.path = hdfs://localhost.localdomain:8020/user/hdfs/flumeLogTest
agent.sinks.snk.hdfs.fileType = DataStream
agent.sinks.snk.hdfs.writeFormat = Text

agent.channels.ch.type = memory
agent.channels.ch.capacity = 100

And I started the flume-agent by the following command :

/usr/bin/flume-ng agent --conf Documents/flume --conf-file Documents/flume/Example1.conf --name agent

where Documents/flume is a folder in /home/cloudera/ this folder contains the following file

  1. flume-conf.properties.template
  2. log4j.properties
  3. flume-env.sh.template
  4. flume-env.sh
  5. Example1.conf

and I'm getting the following error:

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /var/log/flume-ng/flume.log (Permission denied)
    at java.io.FileOutputStream.openAppend(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:192)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
    at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
    at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)
    at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
    at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
    at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842)
    at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
    at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)
    at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
    at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
    at org.apache.flume.node.Application.<clinit>(Application.java:58)

I hope I am clear with the question.Please help me to sort it out. Thanks in advance.

Check the file permissions for /var/log/flume-ng/flume.log and change it.

sudo chown flume /var/log/flume-ng/flume.log

[java.io.FileNotFoundException: /var/log/flume-ng/flume.log (Permission denied)]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM