From f1d9bf373b3d0f3893465a6fb9e685912be719d1 Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Fri, 28 Jul 2017 17:44:51 +0200 Subject: [PATCH] Mark configuration settings in NetFlowCodec as optional While these settings are in fact *not* optional, this seems to be the only way to make existing NetFlow inputs work with the newly added configuration settings without deleting and re-creating the inputs. Fixes #12 --- .../org/graylog/plugins/netflow/codecs/NetFlowCodec.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/graylog/plugins/netflow/codecs/NetFlowCodec.java b/src/main/java/org/graylog/plugins/netflow/codecs/NetFlowCodec.java index 6833974..b174b8c 100644 --- a/src/main/java/org/graylog/plugins/netflow/codecs/NetFlowCodec.java +++ b/src/main/java/org/graylog/plugins/netflow/codecs/NetFlowCodec.java @@ -27,6 +27,7 @@ import org.graylog2.plugin.Message; import org.graylog2.plugin.configuration.Configuration; import org.graylog2.plugin.configuration.ConfigurationRequest; +import org.graylog2.plugin.configuration.fields.ConfigurationField; import org.graylog2.plugin.configuration.fields.NumberField; import org.graylog2.plugin.configuration.fields.TextField; import org.graylog2.plugin.inputs.annotations.Codec; @@ -119,9 +120,9 @@ public void overrideDefaultValues(@Nonnull ConfigurationRequest cr) { public ConfigurationRequest getRequestedConfiguration() { final ConfigurationRequest configuration = super.getRequestedConfiguration(); - configuration.addField(new NumberField(CK_CACHE_SIZE, "Maximum cache size", DEFAULT_CACHE_SIZE, "Maximum number of elements in the NetFlow9 template cache")); - configuration.addField(new TextField(CK_CACHE_PATH, "Cache file path", DEFAULT_CACHE_PATH, "Path to the file persisting the the NetFlow9 template cache")); - configuration.addField(new NumberField(CK_CACHE_SAVE_INTERVAL, "Cache save interval (seconds)", DEFAULT_CACHE_SAVE_INTERVAL, "Interval in seconds for persisting the cache contents")); + configuration.addField(new NumberField(CK_CACHE_SIZE, "Maximum cache size", DEFAULT_CACHE_SIZE, "Maximum number of elements in the NetFlow9 template cache", ConfigurationField.Optional.OPTIONAL)); + configuration.addField(new TextField(CK_CACHE_PATH, "Cache file path", DEFAULT_CACHE_PATH, "Path to the file persisting the the NetFlow9 template cache", ConfigurationField.Optional.OPTIONAL)); + configuration.addField(new NumberField(CK_CACHE_SAVE_INTERVAL, "Cache save interval (seconds)", DEFAULT_CACHE_SAVE_INTERVAL, "Interval in seconds for persisting the cache contents", ConfigurationField.Optional.OPTIONAL)); return configuration; }