Skip to content

Conversation

andsel
Copy link
Contributor

@andsel andsel commented Apr 7, 2022

Release notes

[rn:skip]

What does this PR do?

Fixes the plugin to avoid to pack also the classes of Logstash and log4j.
The example plugin originally used to create a shadow jar with all the dependencies merged into. The dependencies that ends into are also the Logstash classes and the log4j one, which are already provided by the Logstash project itself. This could lead to classpath trashing.
This PR avoid to use shadow the dependencies and leverage the fact that the gem could pack also the jars.
Furthermore adds a MANIFEST, in the plugin's main jar, to mark it as entry point to be recognized by Logstash. This PR to properly works needs a Logstash version with the elastic/logstash#13979.

Why is it important/What is the impact to the user?

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • test locally installing the gem file

How to test this PR locally

  • after populate the LOGSTASH_CORE_PATH property in ./gradle.properties
  • verify the tests with ./gradlew test and build the gem file ./gradlew gem
  • install the gem into a Logstash with:
bin/logstash-plugin install --local /path/to/gem/logstash-input-java_input_example-1.0.2.gem
  • run Logstash pipeline that uses it:
input { java_input_example { count => 2 } } output { stdout { codec => rubydebug } } 

Related issues

Use cases

Screenshots

Logs

@andsel andsel force-pushed the fix/avoid_logstash_in_uber_jar_shading_test_not_working branch from ae1f47a to 28d43d4 Compare August 29, 2022 07:14
@andsel andsel marked this pull request as ready for review September 5, 2022 08:50
@andsel andsel changed the title Fix/avoid logstash in uber jar shading test not working Avoid Logstash's classes in plugin's uber jar due to shading May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request spacetime
1 participant