# Strange behaviour when using both Kafka output and input plugins

**URL:** https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727
**Category:** Logstash
**Created:** [September 3, 2016, 12:34pm UTC](https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727 "2016-09-03T12:34:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ryac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryac/32/11727_2.png) [@ryac](https://discuss.elastic.co/u/ryac)
#### Post date: [September 3, 2016, 12:34pm UTC](https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727/1 "2016-09-03T12:34:03Z")

</div>

Hi all,

Am I able to use both, the output and input Kafka plugins on the same Logstash instance? It seems that the configuration for the _consumer continuously loops through all messages in Kafka forever_. I'm following a structure similar to [this article](https://www.elastic.co/blog/just-enough-kafka-for-the-elastic-stack-part1), the diagram shown below:

```auto
Logstash (shipper) | --> Kafka --> | Logstash (indexer)
01.conf | | 02.conf

```

My 01.conf file is my producer to Kafka, and for testing it looks like this:

```auto
input {
  stdin { }
}

output {
  kafka {
    topic_id => "topicname"
    codec => json
  }
}

```

It will be light, only sending logs to Kafka.

The configuration to consume Kafka messages (02.conf) looks like this:

```auto
input {
  kafka {
    topics => "topicname"
    codec => json
  }
}

output {
  file {
    path => "/var/www/test.log"
  }
  # elasticsearch { }
}

```

For testing, I run the following to load both confs:  
`bin/logstash -f /etc/logstash/conf.d/`

And I get a message that says:

```auto
Settings: Default pipeline workers: 1
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-kafka-5.0.4/vendor/jar-dependencies/runtime-jars/slf4j-log4j12-1.7.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-kafka-5.0.4/vendor/jar-dependencies/runtime-jars/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Pipeline main started

```

I'm running this on Ubuntu 14.04, Logstash 2.4, the plugin versions of Kafka are both 5.0.4, and Kafka 0.10.0.1.

If I test each config separately, I don't get this problem. It's only when I run both at the same time.

Any help would be greatly appreciated!

Thanks,  
Ryan

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 5, 2016, 6:41am UTC](https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727/2 "2016-09-05T06:41:27Z")

</div>

When you have multiple files, LS merges them into one big one and then runs it.

---

<div class="post-metadata">

### Author: ![ryac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryac/32/11727_2.png) [@ryac](https://discuss.elastic.co/u/ryac)
#### Post date: [September 5, 2016, 8:31am UTC](https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727/3 "2016-09-05T08:31:25Z")

</div>

I see.. so that causes the feedback loop.

What is the best way to solve this issue?

---

<div class="post-metadata">

### Author: ![bmaloney](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bmaloney/32/11931_2.png) [@bmaloney](https://discuss.elastic.co/u/bmaloney)
#### Post date: [September 16, 2016, 2:10pm UTC](https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727/4 "2016-09-16T14:10:29Z")

</div>

Ryan, you should be able to solve your particular problem by running two completely separate instances of logstash (two startup scripts, two JVM's, etc).

I have the opposite problem, I want to use logstash to read from Kafka, doctor some messages, and write them into another topic, and unfortunately I can't use the trick to avoid the multiple SLF4J bindings bindings issue (unless I use a socket or something unreliable to pass between two logstashes).

---

<div class="post-metadata">

### Author: ![ryac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ryac/32/11727_2.png) [@ryac](https://discuss.elastic.co/u/ryac)
#### Post date: [September 19, 2016, 2:36am UTC](https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727/5 "2016-09-19T02:36:55Z")

</div>

Hi Brian, thanks for the clarification. That's what I thought.

---

<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: [July 6, 2017, 4:38am UTC](https://discuss.elastic.co/t/strange-behaviour-when-using-both-kafka-output-and-input-plugins/59727/6 "2017-07-06T04:38:02Z")

</div>


