# Is there any option to add a temporary tag / similar variable to logstash entry, not to insert into Elasticsearch?

**URL:** <https://discuss.elastic.co/t/is-there-any-option-to-add-a-temporary-tag-similar-variable-to-logstash-entry-not-to-insert-into-elasticsearch/109511>\
**Category:** Logstash\
**Created:** [November 29, 2017, 5:58am UTC](https://discuss.elastic.co/t/is-there-any-option-to-add-a-temporary-tag-similar-variable-to-logstash-entry-not-to-insert-into-elasticsearch/109511 "2017-11-29T05:58:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [November 29, 2017, 5:58am UTC](https://discuss.elastic.co/t/is-there-any-option-to-add-a-temporary-tag-similar-variable-to-logstash-entry-not-to-insert-into-elasticsearch/109511/1 "2017-11-29T05:58:40Z")

</div>

Hi,

I am using ELK GA 6. In my logstash, I am taking inputs from 3 kafka topics and I perform different filters and outputs based on the kafka topic. Below is a small snippet of how I am doing it now;

```
input {
	kafka{
		group_id => "group_1"
		topics => ["topic_1"]
		add_field => { "logtype" => "logtype_1" }
		.
		.
		.
	}
	kafka{
		group_id => "group_2"
		topics => ["topic_2"]
		add_field => { "logtype" => "logtype_2" }
		.
		.
		.
	}
	kafka{
		group_id => "group_3"
		topics => ["topic_3"]
		add_field => { "logtype" => "logtype_3" }
		.
		.
		.
	}
}

filter {
	if[logtype] == "logtype_1"{
		grok {
			# grok 1 logic
		}
		mutate {
			# mutate 1 logic
		}
	}
	if[logtype] == "logtype_2"{
		grok {
			# grok 2 logic
		}
		mutate {
			# mutate 2 logic
		}
	}
	if[logtype] == "logtype_3"{
		grok {
			# grok 3 logic
		}
		mutate {
			# mutate 3 logic
		}
	}
}

output{
	if[logtype] == "logtype_1"{
		elasticsearch {
			index => "myIndex1"		
			.
			.
		}
	}
	if[logtype] == "logtype_2"{
		elasticsearch {
			index => "myIndex2"		
			.
			.
		}
	}
	if[logtype] == "logtype_3"{
		elasticsearch {
			index => "myIndex3"		
			.
			.
		}
	}
}

```

This works fine, but will create an extra attribute `logtype`. I dont want that to be inserted into my Elasticsearch. Is there any way to do this?

Thank you.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 29, 2017, 6:36am UTC](https://discuss.elastic.co/t/is-there-any-option-to-add-a-temporary-tag-similar-variable-to-logstash-entry-not-to-insert-into-elasticsearch/109511/2 "2017-11-29T06:36:56Z")

</div>

[https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#metadata](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#metadata)

---

<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:** [December 27, 2017, 6:37am UTC](https://discuss.elastic.co/t/is-there-any-option-to-add-a-temporary-tag-similar-variable-to-logstash-entry-not-to-insert-into-elasticsearch/109511/3 "2017-12-27T06:37:17Z")

</div>

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