Hi ELK-bods,
I'm going through my first install of ELK on Linux/RHEL and am not able to run Logstash via systemd as it seems it is not able to find/read the 'logstash-input-elapsed' plugin.
This plugin has been installed correctly and shows up in the plugin list:
[root@gbdocldibgdap02 6.1.0]# /usr/share/logstash/bin/logstash-plugin list elapsed
logstash-filter-elapsed
[root@gbdocldibgdap02 6.1.0]#
Additionally, when I run logstash directly from the command line, it works perfectly - including using the 'elapsed' plugin:
[2018-01-10T09:40:31,436][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"6.1.0"}
[2018-01-10T09:40:31,552][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2018-01-10T09:40:32,237][INFO ][logstash.filters.elapsed ] Elapsed, timeout: 60 seconds
[2018-01-10T09:40:32,239][INFO ][logstash.pipeline ] Starting pipeline {:pipeline_id=>"uat-esb-audit-pipeline", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>125, :thread=>"#<Thread:0x348fd941@/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:245 run>"}
[2018-01-10T09:40:32,297][INFO ][logstash.pipeline ] Pipeline started {"pipeline.id"=>"uat-esb-audit-pipeline"}
[2018-01-10T09:40:32,313][INFO ][logstash.agent ] Pipelines running {:count=>1, :pipelines=>["uat-esb-audit-pipeline"]}
[2018-01-10T09:40:32,644][INFO ][logstash.inputs.jdbc ] (0.035720s) SELECT [rowID_PK] as primary_key
,[createTimestamp] as db_created
,[eventTimestamp] as event_created
FROM [ESB_PREPROD].[esb].[esb_audit]
WHERE [ESB_PREPROD].[ESB].[ESB_AUDIT].[rowID_PK] = 2130648
[2018-01-10T09:40:32,692][INFO ][logstash.filters.elapsed ] Elapsed, 'end event' received {:end_tag=>"END", :unique_id_field=>"unique_composite_id"}
[2018-01-10T09:40:32,832][INFO ][logstash.pipeline ] Pipeline terminated {"pipeline.id"=>"uat-esb-audit-pipeline"}
However, when I try to start logstash via systemd:
systemctl start logstash
I get errors which seem to point to it not being able to find/read/access the 'elapsed' plugin:
[2018-01-10T09:41:50,655][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"/usr/share/logstash/modules/fb_apache/configuration"}
[2018-01-10T09:41:50,657][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"netflow", :directory=>"/usr/share/logstash/modules/netflow/configuration"}
[2018-01-10T09:41:50,909][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"6.1.0"}
[2018-01-10T09:41:50,969][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2018-01-10T09:41:51,646][ERROR][logstash.plugins.registry] Tried to load a plugin's code, but failed. {:exception=>#<LoadError: no such file to load -- logstash/filters/elapsed>, :path=>"logstash/filters/elapsed", :type=>"filter", :name=>"elapsed"}
[2018-01-10T09:41:51,656][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:uat-esb-audit-pipeline, :exception=>"LogStash::PluginLoadingError", :message=>"Couldn't find any filter plugin named 'elapsed'. Are you sure this is correct? Trying to load the elapsed filter plugin resulted in this error: no such file to load -- logstash/filters/elapsed", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/plugins/registry.rb:192:in `lookup_pipeline_plugin'", "/usr/share/logstash/logstash-core/lib/logstash/plugin.rb:140:in `lookup'", "/usr/share/logstash/logstash-core/lib/logstash/plugins/plugin_factory.rb:82:in `plugin'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:114:in `plugin'", "(eval):64:in `<eval>'", "org/jruby/RubyKernel.java:994:in `eval'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:86:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:171:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:40:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:335:in `block in converge_state'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:141:in `with_pipelines'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:332:in `block in converge_state'", "org/jruby/RubyArray.java:1734:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:319:in `converge_state'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:166:in `block in converge_state_and_update'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:141:in `with_pipelines'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:164:in `converge_state_and_update'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:90:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:343:in `block in execute'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}
It may be worth pointing out that the plugin was installed as an offline pack (my machines don't currently have access to the external sites) and I installed as 'root'.
I did notice that the plugin gemspec file was installed as 'root' whereas everything else within /usr/share/logstash/vendor/bundle/jruby/2.3.0/specifications was owned by 'logstash':
I had to chown/chmod this file to 'logstash' user and change the permissions:
[root@gbdocldibgdap02 6.1.0]# chown logstash:logstash /usr/share/logstash/vendor/bundle/jruby/2.3.0/specifications/logstash-filter-elapsed-4.0.3.gemspec
[root@gbdocldibgdap02 6.1.0]# chmod 664 /usr/share/logstash/vendor/bundle/jruby/2.3.0/specifications/logstash-filter-elapsed-4.0.3.gemspec
As without the chown/chmod starting via systemd didn't even get to the stage of running - instead I saw this line within /var/log/messages:
Jan 10 10:05:36 gbdocldibgdap02 logstash: Errno::EACCES: Permission denied - /usr/share/logstash/vendor/bundle/jruby/2.3.0/specifications/logstash-filter-elapsed-4.0.3.gemspec
Can someone advise:
-
When installing plugins, is it a requirement to change the ownership/permissions of the installed plugin after installation? I would have thought the logstash-plugin executable would have handled this?
-
What might be the problem which is stopping logstash from accessing the 'elapsed' plugin when its started via systemd.
All help appreciated as I'm a little stuck at this point
Cheers,
Steve