csv文件类似于:
a,b,c,d
"abc","19840407","1","qwe"
"qwe","19940703","1","abc"
"zxv","19740903","1","zxv"
我在下面写了logstash-csv.conf
input {
file{
path => ["D:\logstash\data\1.csv"]
start_position => "beginning"
}
}
filter {
csv {
source => "message"
separator => ","
quote_char => "\""
columns => ["a","b","c","d"]
skip_empty_rows => true
}
date{
match => ["b","yyyyMMdd"]
}
}
output {
stdout {
}
}
但是在我键入命令“ logstash -f D:\ logstash \ logstash-csv.conf”之后,它显示如下,好像logstash无法正常工作。
[2018-07-24T15:59:25,656][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2018-07-24T15:59:26,632][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"6.3.1"}
[2018-07-24T15:59:34,414][INFO ][logstash.pipeline ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2018-07-24T15:59:38,644][INFO ][logstash.pipeline ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x76042a4b run>"}
[2018-07-24T15:59:38,756][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2018-07-24T15:59:39,433][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
但是,当我在下面更改csv文件
a,b,c,d
abc,19840407,1,qwe
qwe,19940703,1,abc
zxv,19740903,1,zxv
然后,conf文件已在下面进行了修改,可以对其进行解析。
filter {
csv {
separator => ","
columns => ["a","b","c","d"]
skip_empty_rows => true
}
date{
match => ["b","yyyyMMdd"]
}
}
所以,我的问题是,当csv中列的某些字段具有“”或其他字段而不仅仅是(“ abc”,19070101,1243.00,“ test”)时,如何设置conf文件< / strong>