2013-01-22 62 views
1

我使用的是Apache Flume 1.3版,並提及Apache Flume User guide使用Apache Flume管道Apache服務器日誌

我的目標是將pipe Apache server logs直接放入Apache Flume Agent的Channel。如果我的理解是正確的,Apache服務器將不會創建本地文件即, server.log,error.log,但直接將相應的輸出寫入代理的通道;即使它在日誌中寫入,代理也不會從這些文件中讀取。但至少Apache服務器的文檔沒有提供相同的例子。

我的查詢是:

  1. 我提到this鏈接,屬於Cloudera的水槽的建立而不是Apache水槽。我試過,但如預期,Apache服務器給了一個錯誤:

    /bin/sh: flume: not found 
    piped log program 'flume node_nowatch -1 -s -n apache -c \\'apache:console|agentBESink("collector");\\'' failed unexpectedly 
    piped log program 'flume node_nowatch -1 -s -n apache -c \\'apache:console|agentDFOSink("collector");\\'' failed unexpectedly 
    

我懷疑的Apache的水槽的水槽Cloudera的在同步之中。

  1. 按照Apache服務器的文檔: 的Apache httpd可以通過管道寫入錯誤和訪問日誌文件到另一個進程,而不是直接到文件中。 如何做到這一點的運行Apache水槽代理即什麼必須在Apache的conf

的CustomLog條目「|?」共同

回答

1

我正在嘗試類似的用例。你的問題是flume命令不存在(已經)。較新版本的水槽使用命令flume-ng

我在/etc/httpd/conf/httpd.conf中所做的:

# Default behaviour, but daily-rollover logging (|| does not spawn a new shell) 
CustomLog "||/usr/sbin/rotatelogs /var/log/httpd/access_log.%Y-%m-%d 86400" combined 
# Send logging to local flume-agent 
CustomLog "||/usr/bin/flume-ng avro-client -H localhost -p 10000" combined 

水槽劑配置有在localhost一個阿夫羅源綁定和偵聽端口10000。另外一個文件的信道在我們的例子中是一個HDFS接收器。

請注意,當Flume-agent崩潰或重新啓動Flume時,您將失去一些記錄事件。如果您想要更持久的解決方案,您需要拾取(舊/旋轉)日誌文件並在處理時移動/移除。