# Issue with output kafka multiple topics

**URL:** <https://discuss.elastic.co/t/issue-with-output-kafka-multiple-topics/242316>\
**Category:** Beats\
**Tags:** docker, filebeat\
**Created:** [July 23, 2020, 9:55am UTC](https://discuss.elastic.co/t/issue-with-output-kafka-multiple-topics/242316 "2020-07-23T09:55:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![svasilyev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/svasilyev/32/72675_2.png) [@svasilyev](https://discuss.elastic.co/u/svasilyev)\
**Post date:** [July 23, 2020, 9:55am UTC](https://discuss.elastic.co/t/issue-with-output-kafka-multiple-topics/242316/1 "2020-07-23T09:55:13Z")

</div>

i use filebeat 7.8.0 in Docker-Compose  
OS rhel 7

When I try to write logs for multiple topics in kafka, the logs are added to kafka (always one topic (containerlogs) with no selection)  
logs are received at the time of launch and no more of them are added to the kafka until the container is restarted

flibeat.yml

```auto
name: filebeat.host
logging.level: info
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/lib/docker/containers/*/*-json.log
  fields:
    log_topic: 'containerlogs'
- type: log
  enabled: true
  fields:
    log_topic: 'kafkalogs'
  paths:
    - /var/log/kafka/*.log
#
output.kafka:
  hosts: ["kafka_sasl_ssl_server:9093"]
  username: 'filebeat'
  password: 'filebeat-password'
  ssl.enabled: true
  ssl.certificate_authorities: ["root-ca.crt"]
  topic: '%{[fields.kafka_topic]}'
  compression: none
  max_retries: -1
  backoff.max: 10s
  required_acks: 1

```

fields are visible in the ElasticSearch server (with scheme filebeat-\>kafka\<-logstash-\>elasticsearch)

```auto
    "host": {
      "name": "npz-09.vm.cmx.ru"
    },
    "@version": "1",
    "fields": {
      "log_topic": "containerlogs"
    },
    "@timestamp": "2020-07-23T09:29:33.928Z"
  },
  "fields": {
    "@timestamp": [
      "2020-07-23T09:29:33.928Z"
    ]
  },

```

if change topic: 'containerlogs' it works correctly

Help me please correct use fileds setting and mapping multiple kafka topics.

---

<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:** [August 20, 2020, 11:55am UTC](https://discuss.elastic.co/t/issue-with-output-kafka-multiple-topics/242316/2 "2020-08-20T11:55:26Z")

</div>

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