diff --git a/src/main/java/org/graylog2/inputs/mqtt/MQTTTransport.java b/src/main/java/org/graylog2/inputs/mqtt/MQTTTransport.java index 4876ea6..fe370e5 100644 --- a/src/main/java/org/graylog2/inputs/mqtt/MQTTTransport.java +++ b/src/main/java/org/graylog2/inputs/mqtt/MQTTTransport.java @@ -48,10 +48,11 @@ public class MQTTTransport implements Transport { private static final String CK_PASSWORD = "password"; private static final String CK_USERNAME = "username"; private static final String CK_USE_AUTH = "useAuth"; + private static final String CK_CLEINT_ID = "clientID"; private final Configuration configuration; private final MetricRegistry metricRegistry; - private final String clientId; + private String clientId; private ServerStatus serverStatus; private MqttClient client; private List topics; @@ -64,7 +65,6 @@ public MQTTTransport(@Assisted Configuration configuration, this.configuration = configuration; this.metricRegistry = metricRegistry; this.serverStatus = serverStatus; - this.clientId = "graylog2_" + Hashing.murmur3_32().hashUnencodedChars(this.serverStatus.getNodeId().toString()).toString(); } @Override @@ -84,6 +84,8 @@ public void launch(MessageInput messageInput) throws MisfireException { final ConnectReturnCode returnCode; try { + this.clientId = configuration.getString(CK_CLEINT_ID) + + Hashing.murmur3_32().hashUnencodedChars(this.serverStatus.getNodeId().toString()).toString(); if (configuration.getBoolean(CK_USE_AUTH)) { final String username = configuration.getString(CK_USERNAME); final String password = configuration.getString(CK_PASSWORD); @@ -176,6 +178,11 @@ public ConfigurationRequest getRequestedConfiguration() { "tcp://localhost:1883", "This is the URL of the MQTT broker.")); + cr.addField(new TextField(CK_CLEINT_ID, + "Client ID Prefix", + "graylog2_", + "This is the prefix of Clien ID field")); + cr.addField(new BooleanField(CK_USE_AUTH, "Use Authentication", false,