Advertisement
LarryYao

logstash yml

Sep 20th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.33 KB | None | 0 0
  1. input {
  2.   beats {
  3.     port => 5044
  4.   }
  5. }
  6. filter {
  7.     grok {
  8.         match => {
  9.                 "message" => "%{TIMESTAMP_ISO8601:log_timestamp} %{IP:s_ip} %{WORD:cs_method} %{URIPATH:cs_uri_stem} %{NOTSPACE:cs_uri_query} %{NUMBER:s_port} %{NOTSPACE:cs_username} %{IP:c_ip} %{NOTSPACE:cs_useragent} %{NOTSPACE:cs_referer} %{NUMBER:sc_status} %{NUMBER:sc_substatus} %{NUMBER:sc_win32_status} %{NUMBER:time_taken}"
  10.         }
  11.         remove_field => ["message"]
  12.         #存儲的結果中刪除message屬性
  13.     }
  14. }
  15. output {
  16.         if "_grokparsefailure" not in [tags]{
  17.                 #根據規則轉化成功的日誌才輸出到es
  18.                 elasticsearch {
  19.                         # 導出到es,最常用的插件
  20.                         codec => "json"
  21.                         hosts => ["node1.larry.com:9200"]
  22.             index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
  23.             #document_type => "%{[@metadata][type]}"
  24.                         #根據請求接口名動態生成動態
  25.                         #document_type => "test"
  26.                         #flush_size => 500
  27.                         #idle_flush_time => 1
  28.                 }
  29.                 #這裡除了es,還可以把轉換好的內容輸出到其他路徑
  30.         }else{
  31.                 #轉換失敗的日誌就不做處理
  32.         }  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement