0
votes

When I run flume using the command :

bin/flume-ng agent --conf conf --conf-file flume.conf --name agentName -Dflume.root.logger=INFO,console

it runs listing all its log data on the console. I would like to store all this log data (flume's log data) in a file. How do I do it?

2

2 Answers

0
votes

You need to make a custom build of Flume which uses log4j2. You configure log4j2 to use a rolling file appender that rolls every minute (or whatever the latency is that you desire) to a spooling directory. You configure Flume to use a SpoolingDirectorySource against that spooling directory.

You can't use a direct Flume appender (such as what's in log4j2) to log Flume because you will get into deadlock. You can't use log4j1 with a rolling file appender because it has a concurrency defect which means it may write new messages to an old file and the SpoolingDirectorySource then fails.

I can't remember if I tried the Log4j appender from Flume with this setup. That appender does not have many ways to configure it and I think it will cause you problems if the subsequent agent you're trying to talk to is down.

Another approach might be to patch log4j1 and fix that concurrency defect (there's a variable that needs to be made volatile)

(Yes, setting this up is a little frustrating!)

0
votes

dont run with -Dflume.root.logger=INFO,console ,then flume will log in ./logs