最近在折騰logstash,其處理流程不過於input、filter、output三個處理流程,如下是我翻譯的幾個經常使用的處理參數 python
output流之http mysql
output { http { codec => ... # codec (optional), default: "plain" content_type => ... # string (optional) format => ... # string, one of ["json", "form", "message"] (optional), default: "json" headers => ... # hash (optional) http_method => ... # string, one of ["put", "post"] (required) mapping => ... # hash (optional) message => ... # string (optional) url => ... # string (required) verify_ssl => ... # boolean (optional), default: true workers => ... # number (optional), default: 1 } }
input流codec之json格式 sql
input { file { codec => json { charset => ["UTF-8"] (optional), default: "UTF-8" } } }
filter { json { add_field => ... # hash (optional), default: {} add_tag => ... # array (optional), default: [] remove_field => ... # array (optional), default: [] remove_tag => ... # array (optional), default: [] source => ... # string (required) target => ... # string (optional) } }對一個包含json的字段,能夠擴展成一個數據結構
filter流之json_encode
apache
filter { json_encode { add_field => ... # hash (optional), default: {} add_tag => ... # array (optional), default: [] remove_field => ... # array (optional), default: [] remove_tag => ... # array (optional), default: [] source => ... # string (required) target => ... # string (optional) } }
filter { grep { add_field => ... # hash (optional), default: {} add_tag => ... # array (optional), default: [] drop => ... # boolean (optional), default: true ignore_case => ... # boolean (optional), default: false match => ... # hash (optional), default: {} negate => ... # boolean (optional), default: false remove_field => ... # array (optional), default: [] remove_tag => ... # array (optional), default: [] } }
grep過濾器,若是你不想經過哪些事件能夠把它drop掉,或者給每一個匹配的事件增長tags和fields。若是negate的值是true,則匹配到的事件會被丟棄。 json
filter流之grok 數據結構
filter { grok { add_field => ... # hash (optional), default: {} add_tag => ... # array (optional), default: [] break_on_match => ... # boolean (optional), default: true drop_if_match => ... # boolean (optional), default: false keep_empty_captures => ... # boolean (optional), default: false match => ... # hash (optional), default: {} named_captures_only => ... # boolean (optional), default: true overwrite => ... # array (optional), default: [] patterns_dir => ... # array (optional), default: [] remove_field => ... # array (optional), default: [] remove_tag => ... # array (optional), default: [] tag_on_failure => ... # array (optional), default: ["_grokparsefailure"] } }