Conditional error when choosing jdbc_streaming statement

Hello,

I am having an issue in my logstash 5.6.3 and I don't know why (tss those beginners :slight_smile: )
Here is my code (some dummy code in here for my safety XD)

jdbc_streaming {
	jdbc_driver_library => "C:\Program Files\Microsoft JDBC Driver 6.0 for SQL Server\sqljdbc_6.0\enu\jre8\sqljdbc42.jar"
	jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
	jdbc_connection_string => "Server=itisworkinghere;database=itisworkinghere;ApplicationIntent=ReadOnly;"
	jdbc_user => "itisworkinghere"
	jdbc_password => "itisworkinghere"
	
	if [fields][ID] == "2"{
		statement => "select * from table1 tb where tb.id = :Id"
	}
	else if [fields][ID] == "3"{
		statement => "select * from table1 tb where tb.id = :Id"
	}
	else if [fields][ID] == "4"{
		statement => "select * from table1 tb where tb.id = :Id"
	}
	parameters => { "Id" => "%{[fields][ID]}"}			
	target => "[fields][table]"
}	

and the error

Cannot create pipeline {:reason=>"Expected one of #, => at line 30, column 6 (byte 736) after filter {jdbc_streaming { ...mycode... jdbc_password => \"itisworkinghere\"\n\t\t\n\t\tif "}

So as you can see, I think the problem come from the if statement, is there anything wrong??
Can I not use conditional statement in plugin??

Thank you to have read until this point :slight_smile:

You can't have conditionals inside plugin blocks.

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