-
Notifications
You must be signed in to change notification settings - Fork 44
Description
In json-kafka output plugin there is no option to determine multiple Kafka topics in order to load balance messages into topics or separate specific IPFIX message categories into specific Kafka topics. For example, I like to produce IPFIX start-session
messages to the topic ipfix-start
, session-update
to the topic ipfix-update
, and so on. This feature is very useful when your IPFIX consumers need a subset of message types and can subscribe to the topics that they need.
To do this We could determine some pair of Pattern regex and Kafka topic, which means if the regex is matched then produce the message to the topic.
Consider the following json-kafka config file:
<outputPlugins>
<output>
<name>JSON output</name>
<plugin>json-kafka</plugin>
<params>
<outputs>
<kafka>
<name>Send to Kafka</name>
<brokers>127.0.0.1:9092</brokers>
<patternTopic>
<regex>message-type:1</regex>
<topic>ipfix-1</topic>
<partition>unassigned</partition>
</patternTopic>
<patternTopic>
<regex>TCP.{5}8080</regex>
<topic>ipfix-2</topic>
<partition>1</partition>
</patternTopic>
</kafka>
</outputs>
</params>
</output>
</outputPlugins>
In the patternTopic
scope, the regex
, topic
, and partition
fields are defined. The first pattern says that if the received IPFIX message contains message-type:1
then produce it to the topic ipfix-1
and the second pattern says that if the received IPFIX message matches with regex TCP.{5}8080
then produce it to the topic ipfix-2
.
Note: The following patternTopic
result is the same as the current config file description.
<patternTopic>
<regex>.*</regex>
<topic>ipfix</topic>
<partition>unassined</partition>
</patternTopic>
Note: Every user could specify his own pattern regexes according to his own IPFIX templates.