-
Notifications
You must be signed in to change notification settings - Fork 4
Ability to log to a file instead of a database
It would be a substantial improvement if the event log module is able to log events to a file as well, instead of a database.
It would not only prevent the chaos that would be caused during analysis of the logs but also provide a performance boost to the website because appending logs to a file is faster instead of a database.
Upstream issue : https://www.drupal.org/node/2369731
This feature enables the administrator and privileged users to log the events to file instead of a database.
This can be done by enabling the File Log feature in the modules section under statistics package.
Once you enabled this feature, go to the configuration option corresponding to this feature and enable “Save logs to file” checkbox.
This file can be found under sites/default/files/ in the drupal installation folder and is named as eventlog.txt
A new sub-module named event_log_file is added in the event_log folder. The .module file implements the desired action using a couple of hook api functions namely, hook_menu and hook_permission.
Details about this functions can be found at :
-
hook_menu : To register paths to configuration page and associate a callback form function with it. https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu/7.x
-
hook_permission : To enable administrator to provide privileges to different users. https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_permission/7.x
For logging events to a file, the event_log_insert function is modified in the event_log.module file. PHP file i/o functions are used for this purpose.
-
Added Sub-Module does not appear in the same section as the event log
-
No configuration option corresponding to the added sub-module
-
Path to eventlog.txt in the event_log_file module is not working. https://github.com/fresearchgroup/drupal-logger/issues/7
- Add a package name and dependencies to your .info file so that your sub-module appears under the right section, which is statistics in the event_log module case.
E.g : package = Statistics
dependencies[] = event_log
-
Add configure = admin/config/event_log_file
-
Change the path to public://eventlog.txt instead of specifying the complete path. By doing so, a file is automatically created at sites/default/files/ and no permission issues arise.
- Ability to log to a file instead of a database
- Backup event_log database content
- Clear log messages button
- Notify Illegal access to authorized user
- Log Data to Cloud (Experimental)