Yes, there is a way to do this.
You can use the Ad-hoc database
queries plugin to create a query whose results can be written to the server
as a csv file on a scheduled basis. See https://moodle.org/plugins/report_customsql
. The settings you want to use are
- Run to schedule it on a regular basis, Daily, Weekly, Monthly, and
- Export csv report to path /directory to tell it where to save it.
The easiest thing to do is make a output directory under your moodledata directory since the permissions are already all set up. You can FTP it out of there if you want. The path has to be local, however, not on another server.
For your query, just a simple
SELECT * FROM prefix_log_standard_log WHERE timecreated .....
has some sensible time limit that matches the report limit. So, if you want the last 24 hours of logs then WHERE timecreated > (UNIX_TIMESTAMP() - (24 * 3600)) or something like that on your query and then set the report Run to Daily. You may need to up the LIMIT setting to on returned rows. 5000 may or may not be sufficient for 24 of logs on a server depending on usage.
As always, dealing with logs that are huge can have an impact on server performance. Test before implementing.