Hello and thanks for taking a moment of your time to read over this.
I am running Logstash as a collector for SYSLOG messages from networking equipment. Executing the binary while pointing to the configuration file with the -f flag works perfectly; it's only when I rely on the system's service (managed via systemd) do I find that Logstash fails to receive any data from my devices.
Logstash configuration file contents:
input {
udp {
type => "syslog"
port => "514"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "my_index_name_%{+YYYYMMdd}"
}
stdout {
codec => rubydebug
}
if [type] == "syslog" {
kafka {
codec => json
topic_id => "junos_syslog"
}
}
}
host: RHEL 7
installed via: YUM package manager
selinux: disabled
configuration file location / permissions:
➜ ~ ls -l /etc/logstash/conf.d/
total 4
-rw-r--r-- 1 logstash logstash 1613 Apr 19 18:41 logstash.conf
journalctl logs:
➜ ~ sudo journalctl -u logstash -f
Password:
-- Logs begin at Tue 2018-04-17 08:13:17 CDT. --
Apr 19 18:06:03 hounett01 systemd[1]: Stopping logstash...
Apr 19 18:06:04 hounett01 systemd[1]: Started logstash.
Apr 19 18:06:04 hounett01 systemd[1]: Starting logstash...
Apr 19 18:06:19 hounett01 logstash[32414]: Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
Apr 19 18:14:21 hounett01 systemd[1]: Stopping logstash...
Apr 19 18:14:22 hounett01 systemd[1]: Started logstash.
Apr 19 18:14:22 hounett01 systemd[1]: Starting logstash...
Apr 19 18:14:37 hounett01 logstash[1087]: Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
Apr 19 18:18:50 hounett01 systemd[1]: Stopping logstash...
Apr 19 18:18:52 hounett01 systemd[1]: Stopped logstash.
I have increased the debugging level within my logstash.yml file and found that my system is quite upset with the binding to the well-known SYSLOG port of 514
[2018-04-20T09:00:34,036][INFO ][logstash.inputs.udp ] Starting UDP listener {:address=>"0.0.0.0:514"}
[2018-04-20T09:00:34,039][WARN ][logstash.inputs.udp ] UDP listener died {:exception=>#<Errno::EACCES: Permission denied - bind(2) for "0.0.0.0" port 514>, :backtrace=>["org/jruby/ext/socket/RubyUDPSocket.java:197:in `bind'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-udp-3.3.1/lib/logstash/inputs/udp.rb:101:in `udp_listener'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-udp-3.3.1/lib/logstash/inputs/udp.rb:57:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:514:in `inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:507:in `block in start_input'"]}
I'm curious as to understand how we can leverage Logstash to run as a syslog collector if the service cannot request the proper escalation of privileges to run as a service? More importantly, is there anything we can do to correct this issue?