Skip to content

How to access drupal application logs for an environment

This documentation focuses on Drupal application logs, but the same concept could be implemented in PHP applications with the syslog functionality.

Drupal

Drupal's default installation profile come with (Database Logging) dblog enabled, which facilitates you to see the logs on the website itself. However for (high traffic) live sites it is not a good idea to keep it enabled. Luckily there are alternatives:

Syslog

one of them is built in in Drupal: the syslog module, and Dropsolid experience cloud has support for it after some configuration. For more information about the syslog module see the documentation pages.

Configuration steps

  • Determine the unique identifier that will be used. The format is dropsolid-platform_<project machine name>_<environment machine name> Examples:
    • dropsolid-platform_myproject_dev
    • dropsolid-platform_anotherproject_livestaging
  • Enable the syslog module through the UI or CLI.
  • Go to /admin/config/development/logging and configure syslog:
    • Syslog Identity:  the previously determined unique identifier
    • Syslog facility:  select log_local0
    • Syslog format: the default value is ok, but it doesn't contain the severity of a message. See the caveats.

      Screenshot of a filled in form as example: Screen_Shot_2021-01-19_at_09.27.57.png - Ensure these configuration changes are persistent (for D8 and D9: via config export)

Monolog

The monolog module goes even further than syslog, and allows a more granular configuration for what  messages/alerts to log to which location (dblog, syslog, ...)

If you configure monolog to use syslog with the same unique identifier as in the syslog explanation above, you can also download those logs via Dropsolid Platform.

Caveats and good-to-knows

Severity of a log message

Syslog has concepts and logic based on the severity (error, warning, info, debug, ...) of a message. This logic can e.g. store the log messages in separate files based on that severity.

The application logs on Dropsolid Experience Cloud Platform don't use separate files. There is 1 logfile per environment that contains all log messages, regardless of the syslog severity.

If you want to store the severity in the log message, you have to alter the syslog format.

!base_url|!timestamp|!type|!severity|!ip|!request_uri|!referer|!uid|!link|!message

For Drupal 7 sites, severity is not exposed as token for the log message. See the core issue and the patch if you want to add the severity.

How to download the logs

  • On Dropsolid Platform select your project & environment where you want to see logs from.
  • On the right hand side under 'Shortcuts' press the 'Logs' button

    logs_download.png

  • The platform will fetch the logs

    logs_result.png

FAQ

I want to see logs from before today.

Please contact Dropsolid Support by mailing to support@dropsolid.com