[英]Using logstash how can i get the values that are in [ ] to .csv file?
[英]Logstash how to get inputs from .CSV file?
我最近剛剛開始學習 Logstash(和 ELK 堆棧),但我一直在努力從 Logstash 中的 csv 文件中獲取輸入(csv 文件與 .conf 文件位於同一目錄中)。
我只有一個非常簡單的腳本。 我的腳本如下:
input {
file {
path => "C:\elastic\logstash-8.3.2\config\in.csv"
start_position => beginning
}
}
filter {
csv {
separator => ";"
columns => ["Name","Deposit","Month"]
}
mutate {
convert => {
"Deposit" => "integer"
}
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => ["http://localhost:9200"]
index => "randomname"
}
}
csv 文件為“;” 分開,就像這樣一行一行(隨機值):
Name;Number;Month
Name;Number;Month
Name;Number;Month
Name;Number;Month
Name;Number;Month
Name;Number;Month
Name;Number;Month
當我運行 Logstash 時,似乎沒有錯誤,但我沒有看到任何輸入到控制台和/或 ElasticSearch。 為什么會這樣? 有沒有簡單的方法來解決這個問題?
我將 my.conf 文件更改為以下內容,它似乎可以工作。
input {
file {
path => "C:/elastic/logstash-8.3.2/config/in.csv"
start_position => "beginning"
sincedb_path => "NULL"
}
}
filter {
csv {
separator => ";"
columns => ["name","deposit","month"]
}
}
output {
elasticsearch {
hosts => "http://localhost:9200"
index => "randomname"
}
stdout {}
}
logstash 中的文件輸入插件會將文件存儲在 logstash.yml 中的 path.data 位置。 因此,如果您在每次運行時都從同一個文件中讀取,請修改指向 Null 設備的文件指針的位置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.