apache flume日志目录

时间:2016-04-19 03:28:29

标签: flume flume-ng

刚开始学习Apache Flume。我按照Flume官方入门网站上的说明进行操作:

https://cwiki.apache.org/confluence/display/FLUME/Getting+Started

按照上面的说明操作后几乎一切都很好。但之后我找不到任何日志文件。我想日志文件在{flume.directory} / logs下。有没有找到水槽日志文件的想法?

我的log4j.properties:

flume.root.logger=INFO,LOGFILE
flume.log.dir=./logs
flume.log.file=flume.log

log4j.logger.org.apache.flume.lifecycle = INFO
log4j.logger.org.jboss = WARN
log4j.logger.org.mortbay = INFO
log4j.logger.org.apache.avro.ipc.NettyTransceiver = WARN
log4j.logger.org.apache.hadoop = INFO
log4j.logger.org.apache.hadoop.hive = ERROR

# Define the root logger to the system property "flume.root.logger".
log4j.rootLogger=${flume.root.logger}


# Stock log4j rolling file appender
# Default log rotation configuration
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.MaxFileSize=100MB
log4j.appender.LOGFILE.MaxBackupIndex=10
log4j.appender.LOGFILE.File=${flume.log.dir}/${flume.log.file}
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%t] (%C.%M:%L) %x - %m%n


# Warning: If you enable the following appender it will fill up your disk if you don't have a cleanup job!
# This uses the updated rolling file appender from log4j-extras that supports a reliable time-based rolling policy.
# See http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
# Add "DAILY" to flume.root.logger above if you want to use this
log4j.appender.DAILY=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.DAILY.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
log4j.appender.DAILY.rollingPolicy.ActiveFileName=${flume.log.dir}/${flume.log.file}
log4j.appender.DAILY.rollingPolicy.FileNamePattern=${flume.log.dir}/${flume.log.file}.%d{yyyy-MM-dd}
log4j.appender.DAILY.layout=org.apache.log4j.PatternLayout
log4j.appender.DAILY.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%t] (%C.%M:%L) %x - %m%n


# console
# Add "console" to flume.root.logger above if you want to use this
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d (%t) [%p - %l] %m%n

2 个答案:

答案 0 :(得分:0)

因为您的配置使用相对路径:

flume.log.dir=./logs
log4j.appender.LOGFILE.File=${flume.log.dir}/${flume.log.file}

Flume使用您当前的目录进行记录 (启动水槽时的目录)

如果您想强制水槽登录该路径,无论您在何处启动它,都可以使用flume.log.dir的绝对路径。

答案 1 :(得分:0)

根据您的<aa1: parameter1 xsi:nil="true"/> ,它将位于您log4j.properties的同一目录中,这就是flume-agent所做的事情。

因此,如果您从./目录运行,那么它将是

/home

此外,您可以随时使用linux命令找到它,

/home/logs/flume.log

find / -name flume.log ##search in whole disk