0

I have strange problem, im using 10.2.27 mariadb version . created procedure for auditing user connections using init_connect parameter to call the procedure. this procedure working for all the users except one user who is having REPLICATION CLIENT and table level privs and table is not getting updated with this user details where i can see the user connections in the processlist. Please help me how to fix this issue a or any pointer are most appreciated

here is the procedure

DELIMITER //
CREATE PROCEDURE login_trigger()
SQL SECURITY DEFINER
BEGIN
  INSERT INTO test.tracking (user, host, ts)
  VALUES (SUBSTR(USER(), 1, instr(USER(), '@')-1), substr(USER(), instr(USER(), '@')+1), NOW())
  ON DUPLICATE KEY UPDATE ts = NOW();
END;
//
DELIMITER ;

parameter set set from root user of the database
SET GLOBAL init_connect="CALL test.login_trigger()";
Prabhakar
  • 1
  • 1
  • [init_connect](https://mariadb.com/kb/en/server-system-variables/#init_connect) dones't apply to `SUPER` users. Wouldn't an [audit plugin](https://mariadb.com/kb/en/mariadb-audit-plugin-log-format/) be easier? – danblack Sep 02 '21 at 12:13
  • you are correct, audit_plugin requires additional efforts to get track connections and store in table. opted this option for easy and without much overhead on the database. my problem is, for one user not getting tracked and the user do not have super user privs . user is having REPLICATION CLIENT and table level access. – Prabhakar Sep 03 '21 at 14:45
  • by any chance if user is having REPLICATION CLIENT privilege will not be applicable for init_connect – Prabhakar Sep 06 '21 at 09:20

0 Answers0