Recent log messages

The Recent log messages report is probably the most commonly used of the reports available in Drupal core. Any module is able to report its activity here in a standardized way, whether it is for error reporting or simply informational details.

Click on the Recent log messages link, and you'll see a report similar to this:

Recent log messages

Due to the fact that any module can insert messages here, the display can be a little confusing. Each log entry has the following fields:

  • Type: This is defined by the module that recorded the log entry and is most often the module name.
  • Date: The date and precise time (not shown in the preceding screenshot to save space) of the recorded log entry.
  • Message: This field displays more detailed information associated with the log entry. This can be a truncated summary, and if you click on the message, you can often get more information.
  • User: If the message was generated from a logged in session, in which the user was logged in, this will show the user's name. If there was no user logged in, this will say anonymous.
  • Operations: Some log messages may provide additional actions that can be carried out as a consequence of the message—this is determined by the modules, but can include, for example, a link to a settings page to fix a reported error.

Log details

Sometimes, there is more detail to a log entry than the summary report is able to display. Clicking on the message opens up another page with more log details:

Log details

This provides the following additional information that was not on the summary page:

  • Location: The URL being loaded when the log was generated
  • Referrer: The URL immediately preceding the location URL
  • Message: This may be a more detailed message than was presented on the summary screen
  • Severity: The predefined severity levels are in descending order of urgency—Emergency, Alert, Critical, Error, Warning, Notice, Info, and Debug
  • Hostname: The IP address or domain name of the user originating the request

Filtering log messages

When you have a number of modules operating on your Drupal site, it can be difficult to find the messages in the report that you are looking for. On the reports page, there is a filter system to help with this:

  • Go back to the Recent log messages page.
  • Expand the FILTER LOG MESSAGES section:
    Filtering log messages

This will allow you to only show messages for a specific type (for example, just for one module) and specific severity. This is a quick way to reduce the number of entries, so you are only presented with what you are looking for.

For example, to check for login attempts, select user from the Type menu, Notice from the Severity list then click the Filter button:

Filtering log messages

The resultant filtered report may be as follows:

Filtering log messages

This will show you only the log records of interest. Click on the Reset button at any time to clear the filter and display the full list.

Clearing logs

Each log message is stored in the Drupal database, up to a limit defined in the site configuration. It is unwise to store all messages forever, due to the potential amount of data and therefore database size. 1000 messages is a sensible default.

To clear the current list, go back to the main reports screen by navigating to Manage | Reports | Recent log messages.

Expand the CLEAR LOG MESSAGES section:

Clearing logs

This has one simple function—Clear log messages—which will permanently delete all log messages from the database. By default, the maximum number of messages is set to 1,000; to change the setting go to:

Manage | Configuration | Development | Logging and errors:

Clearing logs

Log messages and performance

Recording so much data to your database can have an impact on the performance of your site as it gets busier. For this reason, there is an alternative module in Drupal 8 core called Syslog. Once enabled, Syslog will record exactly the same information that we have been looking at so far into the server log files rather than the Drupal database. This is a significantly faster process, if slightly less convenient for you to access as the site administrator.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset