# Output to more than one Kafka topics

**URL:** <https://discuss.elastic.co/t/output-to-more-than-one-kafka-topics/351929>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 28, 2024, 7:15am UTC](https://discuss.elastic.co/t/output-to-more-than-one-kafka-topics/351929 "2024-01-28T07:15:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ErGeek](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@ErGeek](https://discuss.elastic.co/u/ErGeek)\
**Post date:** [January 28, 2024, 7:15am UTC](https://discuss.elastic.co/t/output-to-more-than-one-kafka-topics/351929/1 "2024-01-28T07:15:53Z")

</div>

Hi,

We are trying to send output to more than one Kafka topics using filebeat. It is not working as expected.  
Output section:

```auto
output.kafka:
  enabled: true

  hosts: ["---"]

 topic: "%{[fields.topic_name]}"
  
  topics:
    - topic: "topic_A"
      when:
      and:
      - equals:
      apptype: "app"
    - topic: "topic_B"
      when:
      and:
      - equals:
      apptype: "book"

  # Use SSL settings for HTTPS.
  ssl.enabled: true

  # Use TLS settings for encryption
  tls.certificate_authorities: ['D:\tmp\kafka.client.truststore.jks']
  
  #================================ Processors =====================================

# Configure processors to enhance or manipulate events generated by the beat.

  processors:
  - fingerprint:
      fields: ["message"]
#================================ Logging =====================================

logging.level: debug
logging.to_files: true
logging.files:
  path: D:\Logs\filebeat
  name: filebeat
  keepfiles: 7
  permissions: 0644

```

Could anyone please help on this?

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [January 29, 2024, 8:23am UTC](https://discuss.elastic.co/t/output-to-more-than-one-kafka-topics/351929/2 "2024-01-29T08:23:43Z")

</div>

HI,

the problem can be the indentation.

Try with this config:

```auto
output.kafka:
  enabled: true
  hosts: ["---"]
  topic: "%{[fields.topic_name]}"
  topics:
    - topic: "topic_A"
      when.equals:
        apptype: "app"
    - topic: "topic_B"
      when.equals:
        apptype: "book"
  ssl.enabled: true
  tls.certificate_authorities: ['D:\tmp\kafka.client.truststore.jks']
processors:
  - fingerprint:
      fields: ["message"]
logging.level: debug
logging.to_files: true
logging.files:
  path: D:\Logs\filebeat
  name: filebeat
  keepfiles: 7
  permissions: 0644

```

Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 26, 2024, 10:24am UTC](https://discuss.elastic.co/t/output-to-more-than-one-kafka-topics/351929/3 "2024-02-26T10:24:13Z")

</div>

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