root@dev01:/usr/share/logstash/bin# ./logstash -configtest -e
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
ERROR: Unrecognised option '-c'
See: 'bin/logstash --help'
Do you have a config file in /etc/logstash/conf.d ?
Did you install it from source or binary?
show me few things here please
a) show me the output of ls /etc/logstash/conf.d
b) show me the output of ps aux | grep logstash
ps aux | grep logstash
root 9005 0.0 0.0 28216 3316 pts/13 S+ 16:31 0:00 systemctl status logstash.service
root 9211 0.0 0.0 16272 928 pts/14 S+ 16:32 0:00 grep --color=auto logstash
oh no forget about everything the command you gave is wrong, it should be
./logstash --config -e that is '--' not '-'
/etc/logstash/conf.d# ls
02-beats-input.conf
input {
beats {
host => x.x.x.33
port => 5044
ssl => false
}
log4j {
mode => "server"
host => x.x.x.169
port => 9300
type => "log4j"
}
}
30-elasticsearch-output.conf
output {
stdout{ codec => rubydebug }
elasticsearch {
host => ["x.x.x.33:9200"]
sniffing => false
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
}
Try this
bin/logstash -f 02-beats-input.conf --config.test_and_exit
root@dev01:/usr/share/logstash# bin/logstash -f 02-beats-input.conf --config.test_and_exit
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path //usr/share/logstash/config/log4j2.properties. Using default config which logs to console
16:42:05.775 [LogStash::Runner] INFO logstash.runner - No config files found in path {:path=>"/usr/share/logstash/02-beats-input.conf"}
16:42:05.781 [LogStash::Runner] FATAL logstash.runner - An unexpected error occurred! {:error=>#<RuntimeError: No config files found: 02-beats-input.conf. Can you make sure this path is a logstash config file?>, :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/config/loader.rb:18:in format_config'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:257:in
execute'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67:in run'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:185:in
run'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132:in run'", "/usr/share/logstash/lib/bootstrap/environment.rb:71:in
(root)'"]}
bin/logstash --path.settings /etc/logstash -f /etc/logstash/conf.d/02-beats-input.conf --config.test_and_exit
This will work for sure. sorry my bad i am still using 2.4 version on some of my old servers.
root@dev01:/usr/share/logstash# bin/logstash --path.settings /etc/logstash -f /etc/logstash/conf.d/02-beats-input.conf --config.test_and_exit
Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
Yeah after this it should tell you something like below
sudo bin/logstash --path.settings /etc/logstash -f /etc/logstash/conf.d/apache.conf --config.test_and_exit
Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
Configuration OK
yeah but configuration ok dint show up
and i cant stop logstash , if i check for logstash status this error comes
root@dev01:/usr/share/logstash# service logstash status
● logstash.service - logstash
Loaded: loaded (/etc/systemd/system/logstash.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-06-22 16:31:27 IST; 22min ago
Process: 8918 ExecStart=/usr/share/logstash/bin/logstash -c /etc/logstash/logstash.yml (code=exited, status=143)
Main PID: 8918 (code=exited, status=143)
Jun 22 16:31:11 dev01 systemd[1]: Started logstash.
Jun 22 16:31:27 dev01 systemd[1]: Stopping logstash...
Jun 22 16:31:27 dev01 systemd[1]: logstash.service: Main process exited, code=exited, status=143/n/a
Jun 22 16:31:27 dev01 systemd[1]: Stopped logstash.
Jun 22 16:31:27 dev01 systemd[1]: logstash.service: Unit entered failed state.
Jun 22 16:31:27 dev01 systemd[1]: logstash.service: Failed with result 'exit-code'.
root@dev01:/usr/share/logstash# kill -9 8918
bash: kill: (8918) - No such process
can you please see what's there in /var/logstash/logstash-plain.log ? paste the recent entries here please