I have been looking at this post How can I log "show processlist" when there are more than n queries?
it is working fine by running this command
mysql -uroot -e "show full processlist" | tee plist-$date.log | wc -l
the problem it is overriding the file
i also want to run it in cronjob. i have added this command to the /var/spool/cron/root
* * * * * [ $(mysql -uroot -e "show full processlist" | tee plist-`date +%F-%H-%M`.log | wc -l) -lt 51 ] && rm plist-`date +%F-%H-%M`.log
but it is not working. or maybe it is saving the log file some place out of the root folder.
so my question is: How to temporary log all queries from specific database and specific table and save the whole queries in 1 file?
note. it is not slow/long quries log iam looking for, but just temp solution to read which queries are running for a database
Aucun commentaire:
Enregistrer un commentaire