【发布时间】:2016-01-12 17:14:00
【问题描述】:
我是 elasticsearch 新手,这是我的 logstash.conf 文件
input {
#stdin {}
file {
path => "/demo_logs/2015-12-14.txt"
start_position => "beginning"
}
}
filter {
csv {
columns => ["data_date", "ip", "method", "status", "time"]
separator => ","
}
}
output {
elasticsearch {
action => "index"
hosts => "localhost"
index => "logstash-%{+YYYY.MM.dd}"
workers => 1
}
stdout { codec => rubydebug }
}
我已经使用 /bin/logstach -f logstash.conf 触发了 conf 文件 loggstash 已启动,没有任何关于打开文件并在 elasticsearch 中编制索引的进程
所以我只是取消注释标准输入{}以获取终端中的输入,如下所示
input{
stdin {}
#file {
#path => "/demo_logs/2015-12-14.txt"
#start_position => "beginning"
#}
}
我再次运行了 conf 文件并将值插入为
2015-12-14 07:29:24.356302,127.0.0.1,get_names,exit,0:00:00.298635
它的显示错误为
Trouble parsing csv {:field=>"message", :source=>"", :exception=>#<NoMethodError: undefined method `each_index' for nil:NilClass>, :level=>:warn}
任何人都可以在这两件事上提供帮助以从 .txt 文件成功执行 logstash.conf 文件并成功索引该 .txt 文件中的所有值。
我也尝试过使用 grok 过滤器,但我做不到,如果它的 grok 过滤器对我也很好的话
谢谢
【问题讨论】:
-
您使用的是哪个版本的 Logstash?
-
用 elasticsearch_http 代替 elasticsearch 怎么样?
标签: elasticsearch indexing logstash logstash-grok