你应该小心,在重新安装之前备份你的数据。
我使用yum安装但手动启动的logstash来解析和发送来自AWS RDS实例的慢速查询日志,我已经将logstash从1.4升级到2.3.3,并且我已经转换了配置文件:
input {
stdin {
codec => multiline {
pattern => "^r*$"
negate => true
what => "next"
}
}
}
filter {
date {
match => ["time", "UNIX"]
}
mutate {
remove_field => ["time", "dumy1", "dumy2"]
}
}
# Output to elastic search
output {
elasticsearch_http {
host => "internal-es-elb-20987489389.eu-west-1.elb.amazonaws.com"
index => "slowquery-%{+YYYY.MM.dd}"
}
}
:
input {
stdin {
codec => multiline {
pattern => "^r*$"
negate => "true"
what => "next"
}
}
}
filter {
date {
match => ["time", "UNIX"]
}
mutate {
remove_field => ["time", "dumy1", "dumy2"]
}
}
# Output to elastic search
output {
elasticsearch {
hosts => "internal-es-elb-20987489389.eu-west-1.elb.amazonaws.com"
index => "slowquery-%{+YYYY.MM.dd}"
ssl_certificate_verification => false
}
}
这是调试模式下的输出:
Reading config file {:config_file=>"/etc/logstash/conf.d/slowquery.conf", :level=>:debug, :file=>"logstash/config/loader.rb", :line=>"69", :method=>"local_config"}
Plugin not defined in namespace, checking for plugin file {:type=>"codec", :name=>"multiline", :path=>"logstash/codecs/multiline", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"76", :method=>"lookup"}
config LogStash::Codecs::Multiline/@pattern = "^\r*$" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@negate = true {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@what = "next" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@patterns_dir = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@charset = "UTF-8" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@multiline_tag = "multiline" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@max_lines = 500 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@max_bytes = 10485760 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/bacula", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/haproxy", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/mcollective", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/aws", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/rails", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/linux-syslog", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/junos", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/postgresql", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/ruby", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/mongodb", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/firewalls", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/bro", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/java", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/exim", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/redis", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/nagios", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/mcollective-patterns", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/grok-patterns", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Registered multiline plugin {:type=>nil, :config=>{"pattern"=>"^\r*$", "negate"=>true, "what"=>"next", "patterns_dir"=>[], "charset"=>"UTF-8", "multiline_tag"=>"multiline", "max_lines"=>500, "max_bytes"=>10485760}, :level=>:debug, :file=>"logstash/codecs/multiline.rb", :line=>"160", :method=>"register"}
Plugin not defined in namespace, checking for plugin file {:type=>"input", :name=>"stdin", :path=>"logstash/inputs/stdin", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"76", :method=>"lookup"}
config LogStash::Codecs::Multiline/@pattern = "^\r*$" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@negate = true {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@what = "next" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@patterns_dir = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@charset = "UTF-8" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@multiline_tag = "multiline" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@max_lines = 500 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Codecs::Multiline/@max_bytes = 10485760 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/bacula", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/haproxy", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/mcollective", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/aws", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/rails", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/linux-syslog", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/junos", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/postgresql", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/ruby", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/mongodb", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/firewalls", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/bro", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/java", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/exim", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/redis", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/nagios", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/mcollective-patterns", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Grok loading patterns from file {:path=>"/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.5/patterns/grok-patterns", :level=>:info, :file=>"logstash/codecs/multiline.rb", :line=>"154", :method=>"register"}
Registered multiline plugin {:type=>nil, :config=>{"pattern"=>"^\r*$", "negate"=>true, "what"=>"next", "patterns_dir"=>[], "charset"=>"UTF-8", "multiline_tag"=>"multiline", "max_lines"=>500, "max_bytes"=>10485760}, :level=>:debug, :file=>"logstash/codecs/multiline.rb", :line=>"160", :method=>"register"}
config LogStash::Inputs::Stdin/@codec = <LogStash::Codecs::Multiline pattern=>"^\r*$", negate=>true, what=>"next", charset=>"UTF-8", multiline_tag=>"multiline", max_lines=>500, max_bytes=>10485760> {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Inputs::Stdin/@add_field = {} {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
Plugin not defined in namespace, checking for plugin file {:type=>"filter", :name=>"date", :path=>"logstash/filters/date", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"76", :method=>"lookup"}
config LogStash::Filters::Date/@match = ["time", "UNIX"] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Date/@add_tag = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Date/@remove_tag = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Date/@add_field = {} {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Date/@remove_field = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Date/@periodic_flush = false {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Date/@target = "@timestamp" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Date/@tag_on_failure = ["_dateparsefailure"] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
Plugin not defined in namespace, checking for plugin file {:type=>"filter", :name=>"mutate", :path=>"logstash/filters/mutate", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"76", :method=>"lookup"}
config LogStash::Filters::Mutate/@remove_field = ["time", "dumy1", "dumy2"] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Mutate/@add_tag = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Mutate/@remove_tag = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Mutate/@add_field = {} {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
config LogStash::Filters::Mutate/@periodic_flush = false {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"153", :method=>"config_init"}
Plugin not defined in namespace, checking for plugin file {:type=>"output", :name=>"elasticsearch", :path=>"logstash/outputs/elasticsearch", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"76", :method=>"lookup"}
进入elasticsearch,我没有找到任何索引,并有这些错误:Plugin not defined in namespace
,但插件安装....
当我试图解析一个简单的日志文件时,我遇到了类似的问题。
最后,我重新安装了logstash,一切都开始正常工作。