Sample code and instructions for Java plugins will omit common configuration (eg. 'id', 'tags')
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- documentation
Research direction
Start with the Java input-plugin instructions and example source, then inspect PluginHelper.commonFilterSettings in logstash-core and PluginUtil.java. Update the affected documentation and example code so the common configuration is represented for the relevant Java plugin types, and verify that the documented examples no longer omit settings such as id and tags.
Written by the indexing model from the issue text.
Description
Logstash 7.9 at least; although as a documentation and example-code issue, it's been around since the Java API was released.
The official instructions and example source code for creatingpure-Java input/filter/output/codec plugins for Logstash leaves out some code which means plugins created according to the instructions will cause a configuration failure such as this:
[ERROR][co.elastic.logstash.api.PluginHelper] Unknown setting 'id' specified for plugin 'mmdb'
This log appears to come from PluginUtil, despite the class indicated in the log.
The provided instructions and code will have you use the following (How to write a Java input plugin):
@Override
public Collection<PluginConfigSpec<?>> configSchema() {
return Arrays.asList(EVENT_COUNT_CONFIG, PREFIX_CONFIG);
}
This should instead be something like the following:
import co.elastic.logstash.api.PluginHelper;
...
@Override
public Collection<PluginConfigSpec<?>> configSchema() {
// The Java example I was looking at doesn't tell
// you that you need to include the common config
// too, nor does it show how.
//
// This form of commonFilterSettings, with an
// argument, will merge the provided settings with
// the common ones for filter.
//
// Note that the checking of arguments is not done
// when we run the unit-tests; that's not our
// code. You may therefore encounter this during
// integration testing instead.
return PluginHelper.commonFilterSettings(
Arrays.asList(
SOURCE_CONFIG,
TARGET_CONFIG,
DATABASE_FILENAME_CONFIG,
CACHE_SIZE_CONFIG,
FIELDS_CONFIG));
}
See the source for commonFilterSetttings
Most of the Java plugins in logstash-core get this right, such as the generator, stdin, uuid; although none of the output plugins do; though according to the documentation they should.
PS. I'm attaching this as an issue to the filter plugin, just because that's what I was working from, but clearly this affects multiple repositories and the documentation, so I'm happy to file this on another repo if you like (and can point me in the correct direction).
Cheers,
Cameron
- Dominant language
- Java
- Stars
- 19
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from logstash-plugins/logstash-filter-java_filter_example
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
logstash-plugins/logstash-filter-java_filter_example#27 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
logstash-plugins/logstash-filter-java_filter_example#15 · 1 comment ·
All issues in logstash-plugins/logstash-filter-java_filter_example
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
inu-appcenter/memorIN-backend#288 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
frontend maui-pilot pilot-ask question
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
area/plugin
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
kestra-io/plugin-kestra#190 ·