MariaDB: Systemd (I assume) hides general_log_file

Hi.

I set this line in a .cnf file in the /etc/my.cnf.d directory:

general_log_file=/tmp/mariadb.log

MariaDB runs without issues, but the file /tmp/mariadb.log is hidden, can’t be listed nor accessed by any user (even root), but it exists, and can be accessed using the MariaDB /proc directory entry:

# ls -fl /proc/`pidof /usr/bin/mariadbd`/fd | grep mariadb.log
l-wx------ 1 mysql mysql 64 ago 26 11:49 13 -> /tmp/mariadb.log
# tail /proc/`pidof /usr/bin/mariadbd`/fd/13 -n 2
210826 11:55:08      26 Connect	root@localhost on galileo using Socket
                     26 Quit	

But, if I use just mariadb.log as the log file (a relative path), the file is created in the MariaDB data directory, and it works fine.

Also, if I run the daemon directly (from bash), the file is created in /tmp as expected. So I assume is a thing from systemd.

How can I fix this?

Thanks!

PrivateTmp is set:

$ systemctl cat mariadb.service | grep -i PrivateTmp
# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
PrivateTmp=true

see systemd.exec and search for PrivateTmp=
If you want to use /tmp for sharing files/logs, create an override and disable it.

2 Likes

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