Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Sample code and instructions for Java plugins will omit common configuration (eg. 'id', 'tags')

Abierto
#22 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Documentación
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
java

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Java
Estrellas
19
Forks
39
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de logstash-plugins/logstash-filter-java_filter_example

Todos los issues de logstash-plugins/logstash-filter-java_filter_example

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.