Change the output of logstash if some criteria in filter fulfilled

Can I have two option on the output module on Logstash (suppose Kafka module) and check if some criteria happen in filter section I should send data to one of the output modules:

for example :

 filter {
if [1] in source:
if [2] in source:

output { 
 if 1_in_source : 
     kafka {
    topic : 1
if 2_in_source : 
    kafka {
   topic: 2

You can certainly use conditionals in the output section, although if the only difference in the output is the topic it might be better to use a single output and a sprintf reference to the topic.

You mean I can check source in output section too? the only change is topic though , but I didn't understand the sprintf section.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.