Mysql Query could not be parsed

Hi All,

I’m implementing a new Alert on my LibreNMS with a custom sql query but for some reason its giving me a “Mysql Query could not be parsed” error but when I run the query in my DB it works perfectly fine!

We have moved over to Plesk and I’m wanting to create a alert on my syslog for when a clients Mailbox is full ( below is the message)

*366CD469352: milter-reject: END-OF-MESSAGE from unknown[xx.xxx.xx.xx]: 4.2.2 Mailbox full; from=<[email protected]eysavingexpert.com> to=<[email protected]> proto=ESMTP helo=<eu-i-ppr-filter...*

but I don’t wanna see all that so my query makes the message look like below.

Mailbox full; from=<[email protected]> to=<[email protected]>

Below is my Query.

SELECT device_id, facility,priority,level,tag,program,
substring_index(substr(msg, instr(msg,"Mailbox ")+ 0 ), "proto", 1) as message FROM librenms.syslog
where priority = 'info' and program = 'POSTFIX/CLEANUP';

so I’m not exactly sure what I’m doing wrong here.

Should I put that query in my Template??

Alert: $sql = "SELECT device_id, facility,priority,level,tag,program,substring_index(substr(msg, instr(msg,"Mailbox “)+ 0 ), “proto”, 1) as message FROM librenms.syslog where priority = ‘info’ and program = ‘POSTFIX/CLEANUP’”;

so I’ve done this

SELECT devices.device_id, facility,priority,level,tag,program,substring_index(substr(msg, instr(msg,"Mailbox ")+ 0 ), “proto”, 1) as message FROM devices,syslog where (devices.device_id = ? AND devices.device_id = syslog.device_id) AND syslog.msg = “Mailmilter-reject” AND syslog.priority = ‘info’ and syslog.program = ‘POSTFIX/CLEANUP’

But Still no Luck