-
Notifications
You must be signed in to change notification settings - Fork 36
Description
There is a problem when attempting to use multiple separate instances of graylog configured to communicate with the same Kinesis stream. The generated application name for the Kinesis client ends up being identical across instances ("graylog-plugin-aws-#stream-name#").
This may work for multiple nodes/workers on the same graylog cluster as its not desired to receive duplicate messages. In my circumstance I have 2 separate graylog instances (customer infra & managed support team infra) and both need to receive a copy of each Kinesis message.
A solution is to build a unique application name based on the graylog clusterId (or node-id if clusterid is null)
As a test I augmented KinesisConsumer.java to accept the clusterId as string in the run() method and augmented the application name with this or use the nodeid if clusterId is null.
String instanceId = null;
if (clusterId == null) {
instanceId = this.nodeId.toString();
} else {
instanceId = clusterId.toLowerCase().substring(0,8);
}
final String applicationName = String.format(Locale.ENGLISH, "gap-%s-%s", instanceId, kinesisStreamName);
KinesisClientLibConfiguration config = new KinesisClientLibConfiguration(applicationName, kinesisStreamName,
authProvider, workerId);
KinesisTransport.java also requried a change to pass in the clusterId value that is now expected..
Previously the dynamoDB in AWS would not even show another table.. now there is a new table for the 2nd graylog instance.
Perhaps there is a more elegant way to fix this?