Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern matching utility to determine output topic in JsonKafka plugin #84

Open
rasaoskuei opened this issue Sep 7, 2023 · 0 comments

Comments

@rasaoskuei
Copy link

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.

rasaoskuei added a commit to rasaoskuei/ipfixcol2 that referenced this issue Sep 7, 2023
rasaoskuei added a commit to rasaoskuei/ipfixcol2 that referenced this issue Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant