A log store for logging to a file.
On large installations, the standard log produced by Moodle and stored in the database can be quite large. On one site I found that the standard log was responsible for over 90% of the data in my database. This made it slow to backup, restore, or move the database.
This plugin allows you to output your logs to a file.
- Create a log file and make sure the webserver can write to it. For example:
touch /var/log/moodle.log && chown www-data:www-data /var/log/moodle.log. - Clone this repository with git or grab a release and place the
files in:
/your/site/admin/tools/log/store/file. - When you visit your site, you will be asked to input the location of the file you created in step 1 (/var/log/moodle.log is the default).
- Optionally, if you want to stop writing logs to the database, you should go to Site administration > Plugins > Logging > Manage log stores and disable the standard log store.
Logs are rendered using a Mustache template. By default each log entry consists of a timestamp and then a JSON representation of the event being logged. For example:
1484664029: { "eventname": "\\core\\event\\calendar_event_created", "component": "core", "action": "created", "etc...": "etc..." }If you want to format your logs, you are free to do so by overridding the template in your theme.