Unable to start logstash - Tried to load a plugin's code, but failed. {:exception=>#<LoadError: no such file to load -- logstash/outputs/microsoft-logstash-output-azure-loganalytics

Hi

We are trying to install the microsoft-logstash-output-azure-loganalytics output plugin to send logs to Azure Log analytics, but getting the following error in Logstash start-up and the Logstash service keeps restarting every few seconds with the following error:

 [2023-08-22T14:41:37,666][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.10.1", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc OpenJDK 64-Bit Server VM 11.0.8+10 on 11.0.8+10 +indy +jit [linux-x86_64]"}
[2023-08-22T14:41:39,745][INFO ][org.reflections.Reflections] Reflections took 29 ms to scan 1 urls, producing 23 keys and 47 values
[2023-08-22T14:41:39,994][ERROR][logstash.plugins.registry] Tried to load a plugin's code, but failed. {:exception=>#<LoadError: no such file to load -- logstash/outputs/microsoft-logstash-output-azure-loganalytics>, :path=>"logstash/outputs/microsoft-logstash-output-azure-loganalytics", :type=>"output", :name=>"microsoft-logstash-output-azure-loganalytics"}
[2023-08-22T14:41:40,001][ERROR][logstash.agent           ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"Java::JavaLang::IllegalStateException", :message=>"Unable to configure plugins: (PluginLoadingError) Couldn't find any output plugin named 'microsoft-logstash-output-azure-loganalytics'. Are you sure this is correct? Trying to load the microsoft-logstash-output-azure-loganalytics output plugin resulted in this error: no such file to load -- logstash/outputs/microsoft-logstash-output-azure-loganalytics", :backtrace=>["org.logstash.config.ir.CompiledPipeline.<init>(CompiledPipeline.java:119)", "org.logstash.execution.JavaBasePipelineExt.initialize(JavaBasePipelineExt.java:83)", "org.logstash.execution.JavaBasePipelineExt$INVOKER$i$1$0$initialize.call(JavaBasePipelineExt$INVOKER$i$1$0$initialize.gen)", "org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:837)", "org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1169)", "org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuperSplatArgs(IRRuntimeHelpers.java:1156)", "org.jruby.ir.targets.InstanceSuperInvokeSite.invoke(InstanceSuperInvokeSite.java:39)", "usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.RUBY$method$initialize$0(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:47)", "org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)", "org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:332)", "org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:86)", "org.jruby.RubyClass.newInstance(RubyClass.java:939)", "org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:207)", "usr.share.logstash.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0(/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:52)", "usr.share.logstash.logstash_minus_core.lib.logstash.pipeline_action.create.RUBY$method$execute$0$__VARARGS__(/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb)", "org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:80)", "org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:70)", "org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:207)", "usr.share.logstash.logstash_minus_core.lib.logstash.agent.RUBY$block$converge_state$2(/usr/share/logstash/logstash-core/lib/logstash/agent.rb:365)", "org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:138)", "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:58)", "org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:52)", "org.jruby.runtime.Block.call(Block.java:139)", "org.jruby.RubyProc.call(RubyProc.java:318)", "org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:105)", "java.base/java.lang.Thread.run(Thread.java:834)"]}
[2023-08-22T14:41:40,008][ERROR][logstash.agent           ] An exception happened when converging configuration {:exception=>LogStash::Error, :message=>"Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`"}
[2023-08-22T14:41:40,039][FATAL][logstash.runner          ] An unexpected error occurred! {:error=>#<LogStash::Error: Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`>, :backtrace=>["org/logstash/execution/ConvergeResultExt.java:129:in `create'", "org/logstash/execution/ConvergeResultExt.java:57:in `add'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:378:in `block in converge_state'"]}
[2023-08-22T14:41:40,048][ERROR][org.logstash.Logstash    ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit

I have installed the logstash plugin and able to list it using logstash-plugin list. I have set the right permissions to the relevant files.

Any idea how to troubleshoot this further?

Best Regards,
Pavan

Attaching my logstash conf file for reference:

input {
  beats {
    port => 5045
  }
}

output {
if [kubernetes][namespace] == "cibc-iso-sit1" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "xyz"
      workspace_key => "12345"
      custom_log_table_name => "remrep_iso_ocp_sit1"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-iso-pte" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "xyz"
      workspace_key => "12345"
      custom_log_table_name => "remrep_iso_ocp_pte"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-iso-sit2" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "xyz"
      workspace_key => "12345"
      custom_log_table_name => "remrep_iso_ocp_sit2"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-iso-uat1" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "xyz"
      workspace_key => "12345"
      custom_log_table_name => "remrep_iso_ocp_uat1"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-iso-uat2" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "xyz"
      workspace_key => "12345"
      custom_log_table_name => "remrep_iso_ocp_uat2"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-cbx-sit1" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "abc" # <your workspace id>
      workspace_key => "67890" # <your workspace key>
      custom_log_table_name => "cbx_ocp_sit1"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-cbx-pte" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "abc" # <your workspace id>
      workspace_key => "67890" # <your workspace key>
      custom_log_table_name => "cbx_ocp_pte"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-cbx-sit2" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "abc" # <your workspace id>
      workspace_key => "67890" # <your workspace key>
      custom_log_table_name => "cbx_ocp_sit2"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-cbx-uat1" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "abc" # <your workspace id>
      workspace_key => "67890" # <your workspace key>
      custom_log_table_name => "cbx_ocp_uat1"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-cbx-uat2" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "abc" # <your workspace id>
      workspace_key => "67890" # <your workspace key>
      custom_log_table_name => "cbx_ocp_uat2"
      amount_resizing => "true"
      }
    }
else if [kubernetes][namespace] == "cibc-cbx-uat3" {
    microsoft-logstash-output-azure-loganalytics {
      workspace_id => "abc" # <your workspace id>
      workspace_key => "67890" # <your workspace key>
      custom_log_table_name => "cbx_ocp_uat3"
      amount_resizing => "true"
      }
    }
}

I have removed the workspace id and workspace keys.

How did you install with bin/logstash-plugin install microsoft-logstash-output-azure-loganalytics or an offline plugin pack?
Is it in the list of plugins? bin/logstash-plugin list '*azure*'
Have you set the same permissions as other plugin directories?
Have you tried to start LS with debug/trace log?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.