0
사용자 정의 로그 필터를 쓰려고합니다. 나는 서류 here을 따라 갔다.은 Java 클래스를로드 할 수 없습니다. uk.co.jaywayco.Parser
처럼 (분에) 내 필터 같습니다
# Call this file 'foo.rb' (in logstash/filters, as above)
require "logstash/filters/base"
require "logstash/namespace"
class LogStash::Filters::NLP < LogStash::Filters::Base
# Setting the config_name here is required. This is how you
# configure this filter from your logstash config.
#
# filter {
# foo { ... }
# }
config_name "nlp"
# New plugins should start life at milestone 1.
milestone 1
# Replace the message with this value.
config :message, :validate => :string
public
def register
# nothing to do
java_import 'uk.co.jaywayco.Parser'
end # def register
public
def filter(event)
# return nothing unless there's an actual filter event
return unless filter?(event)
if @message
# Replace the event message with our message as configured in the
# config file.
event["message"] = @message
end
# filter_matched should go in the last line of our successful code
filter_matched(event)
end # def filter
end # class LogStash::Filters::NLP
필자는 다음과 같습니다 매우 간단한 logstash의 설정을 만들어 :
input {
stdin { type => "nlp" }
}
filter {
if [type] == "nlp" {
nlp {
message => "Hello world! - Youve been NLP'd"
}
}
}
output {
stdout { }
}
난 다음 명령을 logstash을 실행
bin/logstash -f /etc/logstash/conf.d/test.conf
다음 오류가 발생합니다.
The error reported is:
enter code herecannot load Java class uk.co.jaywayco.Parser
Java 클래스 uk.co.jaywayco.Parser
은 /opt/logstash/lib/logstash/filters
폴더에있는 jar 파일에 있습니다. 어느 것이 모든 필터 스크립트가 상주하는지입니다.
왜 내 Java 클래스를 로깅하지 않습니까? 좋아