logstash7.2安裝 入門例子--hello world!
官網下載下傳曆史把本(太慢,有時候通路不了):
https://www.elastic.co/cn/downloads/past-releases
雲盤安裝包提供:
javascript:void(0)
下載下傳7.2版本,解壓即可運作
tar -zxvf logstash-7.2.0.tar.gz
啟動:
#test.conf就是我們需要編寫的配置檔案
bin/logstash -f test.conf
#背景運作
nohup bin/logstash -f test.conf >/dev/null &
#自動加載配置檔案的方式
bin/logstash -f test.conf --config.reload.automatic
#測試配置檔案是否OK
bin/logstash -f test.conf --config.test_and_exit
配置檔案的結構
input {
... #輸入
}
filter {
... #資料處理轉換
}
output {
... #輸出
}
最簡單的例子:
1、vim test.conf,内容如下
input {
stdin { }
}
filter {
}
output {
stdout { }
}
敲入 Hello World !,回車
{
"@timestamp" => 2020-03-25T11:43:41.365Z,
"host" => "es3",
"message" => "hello world !",
"@version" => "1"
}