[英]Logstash CSV output plugin
我正在使用 Logstash 解析包含單行 JSON 數據的文件並將其輸出為 CSV 格式的文件。 它不是將數據輸出為很好的分隔值,而是使用時間戳、主機和消息字段為我提供單行數據。 我在官方 Logstash 論壇上發現了這個問題,但沒有任何回應。 有沒有其他人遇到過這個問題並知道如何解決它或有任何建議? 提前致謝。
電流輸出
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
2017-02-08T16:48:45.907Z %{host} %{message}
期望輸出
timestamp, id, name
timestamp, id, name
timestamp, id, name
input {
file {
path => "input path"
sincedb_path => "C:\Logstash\.sincedb*"
start_position => "beginning"
codec => "json"
type => "type"
}
}
filter {
mutate {
add_field => {"eventName" => "%{[event][eventName]}"}
add_field => {"uniqueDeviceID" => "%{[event][deviceSegment][uniqueDeviceID]}"}
}
prune {
whitelist_names => ["eventName", "uniqueDeviceID", "@timestamp"]
}
}
output {
stdout {codec => rubydebug}
csv {
fields => ["uniqueDeviceID", "eventName", "@timestamp"]
path => "output path"
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.