SQL statement with an union

Hello,

I'm trying to retrieve data from a database using a SQL statement in Logstash with an union in it.

The problem is, logstash only execute the first request and ignore the second request after the 'UNION'.

The request looks like this :

 (SELECT t.id AS col_id,t2.priority AS priority
FROM table1 AS t 
JOIN table2 AS t2 ON t2.id = t.id
WHERE t.last_update>:sql_last_value) 
UNION 
(SELECT t.id AS col_id , NULL AS priority
FROM table1 AS t
JOIN table2 AS t2 ON t2.id = t.id
WHERE t2.id NOT IN(SELECT t.id 
FROM table AS t));

I cut a large amount of the request but the core of it is here.

The request works perfectly on my sql database but stops right before the UNION when the request is executed by logstash... I don't understand why, is Logstash don't allow us to do Union?

Is there an alternative ?

I'm running ELK 6.7.1 and mysql-connector-java 5.1.47.

Any help would be appreciate.

Thank you in advance for your help.

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