# How do I separate the kafka topics from logstash?

**URL:** <https://discuss.elastic.co/t/how-do-i-separate-the-kafka-topics-from-logstash/111528>\
**Category:** Logstash\
**Created:** [December 13, 2017, 10:01am UTC](https://discuss.elastic.co/t/how-do-i-separate-the-kafka-topics-from-logstash/111528 "2017-12-13T10:01:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![david\_k](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@david\_k](https://discuss.elastic.co/u/david_k)\
**Post date:** [December 13, 2017, 10:01am UTC](https://discuss.elastic.co/t/how-do-i-separate-the-kafka-topics-from-logstash/111528/1 "2017-12-13T10:01:11Z")

</div>

Hi all

This question is related to kafka and logstash input, output.  
I try to separate the topics through the following conf file but it doesn't work.

Thanks.

input {  
kafka {  
bootstrap\_servers =\> "localhost:9092"  
topics =\> ["metricbeat-test"]  
type=\>"metricbeat"  
}  
kafka {  
bootstrap\_servers =\> "localhost:9092"  
codec =\> plain {  
format =\> "%{message}"  
}  
topics =\> ["filebeat-test"]  
type=\>"filebeat"  
}

}

filter {

```
if [type] =~ "metricbeat" {
	json {
		source => "message"
	}
} else if [type] =~ "filebeat" {
	json {
        source => "message"
    }

	grok {
    	add_field => {"test" => "test"}
	}
}	

```

}

output {  
stdout { codec =\> rubydebug }

```
if [type] =~ "metricbeat" {
        elasticsearch {
      	      	hosts => ["localhost:9200"] user => elastic password => changeme
            	index => "metricbeat-test%{+YYYY.MM.dd}"
    	}
} else if [type] =~ "filebeat" {
   		elasticsearch {
            	hosts => ["localhost:9200"] user => elastic password => changeme
            	index => "filebeat-test%{+YYYY.MM.dd}"
    	}
}

```

}

---

<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:** [January 10, 2018, 10:01am UTC](https://discuss.elastic.co/t/how-do-i-separate-the-kafka-topics-from-logstash/111528/2 "2018-01-10T10:01:28Z")

</div>

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