RESTful Logger
Security covered
Synopsis
This module provides a REST endpoint for logging messages to Drupal's core logger using JSON with a message value, severity, path, and channel value as documented on the Drupal Logging API documentation.
Requirements
This module requires the following core modules:
Recommended modules
- REST UI module: When enabled, it displays active REST endpoints at Configuration > Services > REST.
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
Configuration
- Enable the module at Administration > Extend.
- Grant the desired permissions needed to the
POST log messagespermission and theAccess POST on Watchdog database logger resourcepermission via the People > Permissions page.
Example JSON POST Body
Required Values:
- message
- path
Default Values:
- The default value for
channelisrestfulloger. - The default value for
severityisNotice.
{
"message": "The message you want to log.",
"severity": "Error",
"channel": "module_machine_name",
"path": "/path/to/page"
}
Troubleshooting
If the logger does not get recorded when POSTing to /dblog/logger
- Ensure the
POST log messagesandAccess POST on Watchdog database logger resourcepermissions are set to the correct roles on the People > Permissions page. - Ensure the REST endpoint is enabled. (This is easier to check using the REST UI module.)
- Ensure your JSON body is formatted correctly and the
messageandpathvalues are defined.
Credits
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.