2014-12-01 5 views

답변

9

편집 :

여기

이 훨씬 더 나은 솔루션입니다 : 당신이 "--use-V1-설정"가 Fluentd에 옵션을 전달하는 경우

, 이것은 "# {ENV [ 'env_var_name'가능하다 ] "이 같은 :

<match foobar.**> # ENV["FOO"] is foobar 
 
    type elasticsearch 
 
    logstash_prefix "#{ENV['FOO']}" 
 
    logstash_format true 
 
    include_tag_key true 
 
    tag_key _key 
 
    host **** 
 
    port **** 
 
</match>

오래, kludgey 답은 여기에있다. 다음과 같이

  1. fluent-plugin-record-reformerfluent-plugin-forest
  2. 업데이트를 귀하의 설정을 설치합니다. 특히

    <match hello.world> 
     
        type record_reformer 
     
        tag ${ENV["FOO"]}.${tag_prefix[-1]} # adding the env variable as a tag prefix 
     
    </match> 
     
    
     
    <match foobar.**> # ENV["FOO"] is foobar 
     
        type forest 
     
        subtype elasticsearch 
     
        <template> 
     
        logstash_prefix ${tag_parts[0]} 
     
        logstash_format true 
     
        include_tag_key true 
     
        tag_key _key 
     
        host **** 
     
        port **** 
     
        </template> 
     
    </match>

이있다 <match **>를 사용하지 마십시오. 그러면 모든 이벤트를 포착하고 디버그하기 어려운 행동으로 이어질 것입니다.

+0

https://groups.google.com/forum/#!topic/fluentd/z-1vIsQ4kHU에서 '/ etc/default/td-agent'의 --use-v1-config에 대한 환경 변수를 유지해야합니다. 'like this :'export FOO = "foobar"' – arun

+0

/etc/default/td-agent는 debian 패밀리 용입니다. redhat 제품군의 경우/etc/sysconfig/td-agent를 대신 사용하십시오. – sMiLo