简体   繁体   English

Apache Flume /var/log/flume-ng/flume.log(权限被拒绝)

[英]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 . 我正在尝试从/ home / cloudera / Documents / flume /中读取日志文件,并使用apache flume将其写入hdfs。 I used the following command to create flumeLogTest folder in hdfs : 我使用以下命令在hdfs中创建flumeLogTest文件夹:

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 : 然后我通过以下命令启动了flume-agent:

/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 其中Documents / flume是/ home / cloudera /中的文件夹,此文件夹包含以下文件

  1. flume-conf.properties.template 水槽,conf.properties.template
  2. log4j.properties log4j.properties
  3. flume-env.sh.template 水槽,env.sh.template
  4. flume-env.sh flume-env.sh
  5. Example1.conf 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. 检查/var/log/flume-ng/flume.log的文件权限并进行更改。

sudo chown flume /var/log/flume-ng/flume.log 须藤弦笛/var/log/flume-ng/flume.log

[java.io.FileNotFoundException: /var/log/flume-ng/flume.log (Permission denied)] [java.io.FileNotFoundException:/var/log/flume-ng/flume.log(权限被拒绝)]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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