I need the Linux user that PHP uses to have access to the MariaDB error log so that way I can review it for a few seconds every few days. If the CHMOD is changed by sometime in the system then I have to manually go back through a long list of technical things to re-CHMOD it from 640 to 644.
So I discovered the following query which eventually led me to finding out the Barnum & Bailey and hackers were brute-force guessing pass words on my personal desktop. So I changed the port and restricted the IP addresses, problem solved. That being said, I want to be vigilant by keeping tabs on various system logs on my live server (which is not my desktop) in my web based system by clicking a couple links. Way easier than SSH, FTP, CHMOD, etc.
Going back to the start, I recently became aware of this SQL query for MariaDB:
That in turn revealed the MariaDB error log is located at /var/log/mysql.error.log. However, both cPanel and CloudLinux have a lot of, complications. So I go to the directory with my FTP and see the following relevant files:
So I did a search for "mariadb error log per day" (without the quotes) and after a bit of browsing I came across the logrotate command. So I ran the following command in PuTTY/SSH:
I copied the results to Notepad++ and quickly found the following from the 50+ lines:
/etc/logrotate.d/mariadb:# This is the MariaDB configuration for the logrotate utility
Okay, this looks about as relevant as it's going to get as I'm not a server administrator.
Now, I know enough about Linux that I can generally get around, okay, like a 3/10 skill wise. So I've got the experience to know that if I delete that file that there is a 50/50 chance that something will automatically regenerate it and thus restore the rotation of the log file and thus the CHMOD will get changed back from 644 (good) to 640 (bad).
So, with all of that context in mind: how do I ensure that when I change the CHMOD of /var/log/mysql.error.log to 644 that it stays CHMO 644 until the end of all eternity? Is it a command I need to execute for logrotate? Can I simply download a copy of the file logrotate.d/mariadb file and then delete it from the server and not have to be concerned with it ever again? Is there something entirely different that is actually handling or doing even more stuff with the log? Thank you in advance for any time used to provide help.
So I discovered the following query which eventually led me to finding out the Barnum & Bailey and hackers were brute-force guessing pass words on my personal desktop. So I changed the port and restricted the IP addresses, problem solved. That being said, I want to be vigilant by keeping tabs on various system logs on my live server (which is not my desktop) in my web based system by clicking a couple links. Way easier than SSH, FTP, CHMOD, etc.
Going back to the start, I recently became aware of this SQL query for MariaDB:
Code:
SHOW GLOBAL VARIABLES LIKE 'log_error';
- /var/log/mysql.error.log-20250716
- /var/log/mysql.error.log-20250717
- /var/log/mysql.error.log-20250718
- /var/log/mysql.error.log-20250719
So I did a search for "mariadb error log per day" (without the quotes) and after a bit of browsing I came across the logrotate command. So I ran the following command in PuTTY/SSH:
Code:
grep -r "logrotate" / -s
/etc/logrotate.d/mariadb:# This is the MariaDB configuration for the logrotate utility
Okay, this looks about as relevant as it's going to get as I'm not a server administrator.
Now, I know enough about Linux that I can generally get around, okay, like a 3/10 skill wise. So I've got the experience to know that if I delete that file that there is a 50/50 chance that something will automatically regenerate it and thus restore the rotation of the log file and thus the CHMOD will get changed back from 644 (good) to 640 (bad).
So, with all of that context in mind: how do I ensure that when I change the CHMOD of /var/log/mysql.error.log to 644 that it stays CHMO 644 until the end of all eternity? Is it a command I need to execute for logrotate? Can I simply download a copy of the file logrotate.d/mariadb file and then delete it from the server and not have to be concerned with it ever again? Is there something entirely different that is actually handling or doing even more stuff with the log? Thank you in advance for any time used to provide help.
Comment