logstash 多實(shí)例運(yùn)行

執(zhí)行l(wèi)ogstash同步腳本時(shí)出現(xiàn)如下報(bào)錯(cuò):

Logstash could not be started because there is already another instance using the configured data directory. If you wish to run multiple instances, you must change the "path.data" setting

將原先的命令:

bin/logstash -f config/mailflow.conf

改為:

bin/logstash -f config/mailflow.conf --path.data=/logstash/mailflow

其中,--path.data是指存放數(shù)據(jù)的路徑

同步最近1小時(shí)數(shù)據(jù)腳本:

input {
elasticsearch {
hosts => "ESIP:9200" #配置 elasticsearch的地址及index
index => "mailflow*"
query => '{ "query": {"range":{"@timestamp": {"gte": "now-1h"}}}}'
size => 10000 #配置遍歷數(shù)據(jù)
scroll => "5m" # 配置遍歷時(shí)間間隔
docinfo => true
}
}

filter {
mutate{
convert => { "time-taken" => "integer" }
}
}

output {
elasticsearch {
hosts => "esip:9200"
index => "%{[@metadata][_index]}"
document_type => "%{[@metadata][_type]}"
document_id => "%{[@metadata][_id]}"
}}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容