dumb question about enabling error logs
hello -
i thought i understood that error logs are ALWAYS enabled. so i added the following two lines to my.cnf and restarted:
[mysqld] sql_mode=NO_ENGINE_SUBSTITUTION skip-networking=1 plugin_load_add = server_audit log_error=/var/log/mariadb.err.log
but "/var/log/mariadb.err.log" is not being created. how do i enable mariadb to start writing audits to a logfile?
SHOW VARIABLES LIKE '%error'; +---------------+--------------------------+ | Variable_name | Value | +---------------+--------------------------+ | log_error | /var/log/mariadb.err.log | SHOW VARIABLES LIKE 'log_output'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_output | FILE | +---------------+-------+ MariaDB [(none)]> SHOW VARIABLES LIKE 'general_log%'; +------------------+-----------------+ | Variable_name | Value | +------------------+-----------------+ | general_log | OFF | | general_log_file | mydomainname.log | +------------------+-----------------+ Server version: 10.2.24-MariaDB MariaDB Server Linux mydonmain.info 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Answer Answered by Ian Gilfillan in this comment.
Errors are always written, but not always to log file. If log_error is not enabled, errors will be logged to stderr. See Error Log. Note also that the error log, the General Query Log and the Audit Plugin are all different things.
As to why the error log is not being written, check file permissions (though the server shouldn't start if it can't write the log file), or specify log_error
with no location in order to write to the default location to test. Also, to help track down errors, I suggest doing one thing at a time - first get error logs working, then implement the audit plugin if you need it.