我正在尝试从/ home / cloudera / Documents / flume /读取日志文件,并使用apache flume将其写入hdfs。我使用以下命令在hdfs:
中创建flumeLogTest文件夹sudo -u hdfs hadoop fs -mkdir flumeLogTest
sudo -u hdfs hadoop fs -chown flume:flume flumeLogTest
我的配置文件是:
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
我通过以下命令启动了flume-agent:
/usr/bin/flume-ng agent --conf Documents/flume --conf-file Documents/flume/Example1.conf --name agent
其中Documents / flume是/ home / cloudera中的文件夹/此文件夹包含以下文件
我收到以下错误:
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)
我希望我清楚这个问题。请帮我解决一下。 提前谢谢。
答案 0 :(得分:0)
检查/var/log/flume-ng/flume.log的文件权限并进行更改。
sudo chown flume /var/log/flume-ng/flume.log
[java.io.FileNotFoundException:/var/log/flume-ng/flume.log(Permission denied)]