# Unable to Ship logs through Grafana Loki plugin

**URL:** <https://discuss.elastic.co/t/unable-to-ship-logs-through-grafana-loki-plugin/296535>\
**Category:** Logstash\
**Created:** [February 8, 2022, 12:30am UTC](https://discuss.elastic.co/t/unable-to-ship-logs-through-grafana-loki-plugin/296535 "2022-02-08T00:30:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPablo1982](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@JPablo1982](https://discuss.elastic.co/u/JPablo1982)\
**Post date:** [February 8, 2022, 12:30am UTC](https://discuss.elastic.co/t/unable-to-ship-logs-through-grafana-loki-plugin/296535/1 "2022-02-08T00:30:26Z")

</div>

Hello

I am trying to get to work the Grafana loki Plugin for Logstash but I am getting a runtime error, here is the detail.

Grafana Loki plugin was installed successfully by executing the following command:

sudo /usr/share/logstash/bin/logstash-plugin install logstash-output-loki.  
Validating logstash-output-loki  
Installing logstash-output-loki  
Installation successful

However the version that got installed was logstash-output-loki (1.0.3) and not the latest and I think it is due to our current logstash version... Which is 6.4.2, but the installation was successful so it does not represent a problem at this moment for me. (I think that since higher versions throws error during installation)

I added the loki section within the output element from the configuration file and then ran the consistency check for the config prior doing the change.

sudo /usr/share/logstash/bin/logstash --config.test\_and\_exit -f /tmp/testing.loki

Configuration OK  
[INFO] 2022-02-07 21:24:55.114 [LogStash::Runner] runner - Using config.test\_and\_exit mode. Config Validation Result: OK. Exiting Logstash

But the services started to crash with the following fatal error within the logs:

[2022-02-05T05:50:19,546][FATAL][logstash.runner] An unexpected error occurred! {:error=\>#\<NoMethodError: undefined method `append' for #<Array:0x3dad3e98>>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-loki-1.0.3/lib/logstash/outputs/loki/batch.rb:25:in `add'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-loki-1.0.3/lib/logstash/outputs/loki.rb:190:in `add_entry_to_batch'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-loki-1.0.3/lib/logstash/outputs/loki.rb:99:in `block in max\_batch\_size'", "org/jruby/ext/thread/Mutex.java:148:in `synchronize'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-loki-1.0.3/lib/logstash/outputs/loki.rb:98:in `block in max\_batch\_size'", "org/jruby/RubyKernel.java:1292:in `loop'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-loki-1.0.3/lib/logstash/outputs/loki.rb:90:in `max\_batch\_size'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-loki-1.0.3/lib/logstash/outputs/loki.rb:86:in `block in register'"]}

I am a bit lost on what the issue could be or the resolution.

Do you have any advice or ideas on how to troubleshoot this issue?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 8, 2022, 1:17am UTC](https://discuss.elastic.co/t/unable-to-ship-logs-through-grafana-loki-plugin/296535/2 "2022-02-08T01:17:58Z")

</div>

> [@JPablo1982](#):
>
> > error=\>#\<NoMethodError: undefined method `append' for #Array:0x3dad3e98\>,
> 
> > :backtrace=\> ["/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-loki-1.0.3/lib/logstash/outputs/loki/batch.rb:25:`

It is blowing up [here](https://github.com/grafana/loki/blob/ffc87055b8d4bda594bf7c5b077a5fe6bd5eb8c9/clients/cmd/logstash/lib/logstash/outputs/loki/batch.rb#L25), trying to append an entry to an array.

You appear to be running jruby/2.3.0. The .append method as an alias for .push was only added in JRuby 2.5.0 according to [this](https://www.bigbinary.com/blog/array-prepend-and-array-append-in-ruby-2-5) blog.

The [gemspec](https://www.bigbinary.com/blog/array-prepend-and-array-append-in-ruby-2-5) for the plugin does not include a dependency on the jruby version. I am not familiar enough with Ruby development best practices to know whether it should (which would cause the plugin installation to fail).

Your best option would be to upgrade to the latest logstash version, which includes security fixes not in 6.4.2, which is coming up on two years past EOL.

Another option would be to fork the repository for the plugin, edit the .append to be .push, and build the plugin yourself.

---

<div class="post-metadata">

**Author:** ![JPablo1982](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@JPablo1982](https://discuss.elastic.co/u/JPablo1982)\
**Post date:** [February 8, 2022, 1:26am UTC](https://discuss.elastic.co/t/unable-to-ship-logs-through-grafana-loki-plugin/296535/3 "2022-02-08T01:26:25Z")

</div>

Hello

Thank you for the prompt response and your contribution.

I just found this: [https://github.com/grafana/loki/issues/3349](https://github.com/grafana/loki/issues/3349) where the reporter mentioned it has been fixed after the upgrade like you are suggesting. I will definitively consider that and evaluate the risks on going through that path in regards existing input/outputs plugins to AWS S3 buckets. Hopefully there are no conflicts with it.

I'll go through the second option in case the upgrade is not possible from our side.

Thanks again!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 8, 2022, 1:26am UTC](https://discuss.elastic.co/t/unable-to-ship-logs-through-grafana-loki-plugin/296535/4 "2022-03-08T01:26:59Z")

</div>

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