I'm trying to use log4j2 to send messages to our Logstash instance.
I'm running this command:
bin\logstash -r -p "C:\elasticsearch_course\logstash-input-log4j2" -f "C:\elasticsearch_course\logstash_data\test.conf"
The test.conf file:
input {
log4j2 {
port => 7000
mode => "server"
}
file {
path => "D:/logs/application.log"
sincedb_path => "nul"
start_position => "beginning"
}
}
filter {
grok {
match => {
"message" => "%{NOTSPACE:date} %{NOTSPACE:time} %{WORD:level} %{NUMBER:FIELD1} %{NOTSPACE:FIELD2} %{NOTSPACE:FIELD3} %{NOTSPACE:class}%{SPACE}%{NOTSPACE:FIELD4} %{WORD:method}"
}
remove_field => ["FIELD1","FIELD2","FIELD3","FIELD4"]
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => ["localhost:9200"]
index => "gopher-%{+YYYY.MM.dd}"
manage_template => true
template => "C:\elasticsearch_course\logstash_data\gopher_mapping.json"
template_name => "gopher_template"
}
}
I'm getting the following error:
Validating logstash-input-log4j2
Installing logstash-input-log4j2
Plugin version conflict, aborting
ERROR: Installation Aborted, message: Bundler could not find compatible versions for gem "logstash-core":
In snapshot (Gemfile.lock):
logstash-core (= 6.6.0)
In Gemfile:
logstash-core-plugin-api (>= 0) java depends on
logstash-core (= 6.6.0) java
logstash-input-syslog (>= 0) java depends on
logstash-filter-grok (>= 0) java depends on
logstash-core (>= 5.6.0) java
logstash-input-log4j2 (>= 0) java depends on
logstash-core (< 2.0.0, >= 1.4.0) java
logstash-core (>= 0) java
Running bundle update
will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Bundler could not find compatible versions for gem "logstash":
In Gemfile:
logstash-input-log4j2 (>= 0) java depends on
logstash (< 2.0.0, >= 1.4.0) java
Could not find gem 'logstash (< 2.0.0, >= 1.4.0) java', which is required by gem 'logstash-input-log4j2 (>= 0) java', in any of the sources.
I'm using the latest versions of Logstash (6.6.0) and the plugin that I can find. I'm on a Windows machine and don't have much skill with Linux so I'm trying to translate from the references I've seen here and the log4j2 references.
How do I install the log4j2 plugin into Logstash on a Windows 10 computer?