2016-08-03 6 views
0

Logstash私は現在、ログラインをフラットな構造のイベントに解析するためにgrokを使用しています。例えばログスタッシュイベントに追加されたフィールドを構造化する方法は?

:あなたはこのようmutateフィルタを使用し合うようにあなたのデータをgrokkingした後、あなたのフィールドを再編成することができます

{ 
location : { 
    file: "ServiceDao" 
    line: 47 
} 
thread : { 
    name: "main-thread" 
    number: "3" 
} 
} 

答えて

0

{ 
location_file_name: "ServiceDao.java" 
location_line_number: 47 
thread_name: "main-thread" 
thread_number: "3" 
} 

どのように私は代わりにそれを解析することができます

filter { 
    grok { 
     ... 
    } 
    mutate { 
     add_field => { 
      "[location][file]" => "%{location_file_name}" 
      "[location][line]" => "%{location_line_number}" 
      "[thread][name]" => "%{thread_name}" 
      "[thread][number]" => "%{thread_number}" 
     } 
     remove_field => ["location_file_name", "location_line_number", "thread_name", "thread_number"] 
    } 
} 
+0

これで運がいいですか? – Val

関連する問題