简体   繁体   中英

MySQL --> Enable general log and move it to another drive/device

I need to enable mysql general log and to move it to another drive/device that i've in my system by nsf!

So, i've enable it in my.cnf:

general_log     = 1
 general_log_file = /nsf/directory
 expire_logs_days = 7

I guess the log can't write directly in that directory right?

How can I do this?

I've think in another solution, like to write logs in /var/log/ and to rotate them and them move it to nfs? Or do some script to run in cronjob?

As per my understanding you can't generate log in nfs but yes you can move to nfs by script after logging in any server partition.

you can schedule a cron, which will either purge logs after an interval or copy in another file and purge log file as per your requirement.

Even you can generate general query logs in table instead of file and analyze through sql query in better way, also archive old logs from table and remove from table.

So check your requirement and take decision accordingly.

Note: This is for your information that expire_logs_days is a variable for binary log not general query log.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM