2016-05-15 4 views
1

フィールド値に基づいてlogstashで動的に辞書を翻訳する方法は? は、例えば、私の現在の構成は次のとおりです。フィールド値に基づいてlogstashで動的に辞書を動かすには?

if [host] == "1.1.1.1" { 
    translate { 
     field => "[netflow][input_snmp]" 
     destination => "[netflow][interface_in]" 
     dictionary_path => "/etc/logstash/yaml/1.1.1.1.yml" 
    } 
} 
if [host] == "2.2.2.2" { 
      translate { 
        field => "[netflow][input_snmp]" 
        destination => "[netflow][interface_in]" 
        dictionary_path => "/etc/logstash/yaml/2.2.2.2.yml" 
      } 
} 

は、これを達成するための一般的な方法はありますか? Logstashバージョン私はあなたのようにそれを使用することができますね2.2.4

おかげ

答えて

1

:{翻訳:私がこのようにそれを使用することはできませんようだhttps://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf

+1

:という

translate { field => "[netflow][input_snmp]" destination => "[netflow][interface_in]" dictionary_path => "/etc/logstash/yaml/%{host}.yml" } 

チェック #この設定はパスでなければなりません #ファイルが存在しないか、開くことができません/etc/logstash/yaml/%{host}.yml dictionary_path => "" /etc/logstash/yaml/%{host}.yml " – eladelad

+0

ここでもフィールドプレースホルダはdictionary_pathで動作していないようです。 @alpert他のアイデア? – sermolaev

+0

"/etc/logstash/yaml/%{[host]}.yml" @sermolaevを使ってみましたか? – alpert

関連する問題