Jdbc add field

Hi!
I am trying to add field in to a type by using if statement. But logstash report error

[LogStash::Runner] ERROR logstash.agent - fetched an invalid config

Here is my filter part

filter {
if [type]=product{
mutate {
	add_field => { "product_suggest" => "%{display_name}" }
	add_field => { "product_suggester" => "%{display_name}" }
	remove_field => ["attribute_value_en ", "attribute_value_sc "]
}
}
if [type]=merchant{
mutate {
	add_field => { "merchant_suggest" => "%{merchant_name}" }
	add_field => { "merchant_suggester" => "%{merchant_name}" }
}
}
}

Does any one get some idea where I worry? or any method that can add field by type?

I found the problem, it should write like this

filter {
if [type] == "product"{
	mutate {
		add_field => { "product_suggest" => "%{display_name}" }
		add_field => { "product_suggester" => "%{display_name}" }
		remove_field => ["attribute_value_en", "attribute_value_sc"]
	}
}
if [type] == "merchant"{
	mutate {
		add_field => { "merchant_suggest" => "%{merchant_name}" }
		add_field => { "merchant_suggester" => "%{merchant_name}" }
	}
}
}
1 Like

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