Mastering your system log

Contents

  1. Log alerts
  2. Deleting specific log entries
  3. Jump to page in the log

Log Alerts

Use log alerts to receive email notifications when specific log messages are recorded in the system log. 

Why Use Log Alerts

Let's say that your checkout process has been running smoothly, but one day a customer emails you because they can't check out. You look in the log and find a message that includes the text "checkout error" in the description. You search the log and find that this has happened several times in the past. You have been losing sales!

This is where log alerts come in handy. Using the Advanced Log plugin, you can create an alert to notify you whenever this error is logged. Instead of waiting days or weeks for a customer to email you, or having to remember to search the log periodically, the alert runs in the background letting you know whenver the error is logged. 

How to Create a Log Alert

Search the system log for a message, and verify that the results match what you want to be notified about. Then click the Add Alert button. This brings up the Create Alert screen shown below. 

  • Enter an alert name you can use to identify the alert later
  • Enter the search text that will be used to search log messages
  • Check the is enabled checkbox to enable notifications for the alert
  • Enter a send to email address to receive the alerts
  • Set the alert frequencey to control how often the log is scanned for the message (see the configure section below)

Click the Save button to save the alert, which will display in the Log Alerts list shown below

 

Alert frequency

The alert frequency setting controls how often the log is scanned for each alert. When the plugin is installed a default value of 10 minutes is used. You can change the default value on the configure page. 

For time-sensitive alerts that do not occur often, such as the "checkout error" scenario duscussed in the section why use log alerts, a shorter frequency is recommended. However, if you use a shorter frequency on alerts that occur often, you will receive a lot of alert emails.

For example, if you create an alert with a search text of "404", and set the frequency to 1 minute, you will likely receive a notification every minute because most websites are subject to scan bots that constantly search for pages that do not exist, which generates many 404 messages in the log. 

A better approach would be to set the frequency to 60, in which case you would receive one email every hour. These emails would contain all the 404 messages that were logged over the previous hour. 

Alternatively, you could set it to 1440, which is 24 hours (60 minutes * 24 hours = 1440). In this case you would receive one email each day listing all the 404 messages logged during the previous 24 hours. 

 

Testing an Alert

Now that you have an alert created, you can test to make sure it is working by clicking the Test button. 

This will add an entry to the system log that contains the Search Text embedded in a message that indicates it is only a test, and not a real instance of the log message. 

The Advanced Log Plugin runs in the background on a timer. Once the scheduled time you set for the log alert has elapsed, an email message will be added to the Message Queue, which you can view in your website's message queue at Admin > System > Message queue

Messages in the queue are sent out on a schedule task which runs every minute by default.  

 

Disabling Alerts

If you wish to pause one of your alerts, you can simply disable it by editing the alert, and unchecking the is enabled check box. Once you save the alert, it will appear as disabled in the alert list, and you will no longer receive alerts for that specific search text. This can be useful when you want to pause notifications, but may want to receive them again at a future date. 

 

Configure

Use the Configure button on the log alerts list page to set default values to be used when creating new log alerts. 

  • Default send to email address - automatically populates the send to field when creating a new log alert.
  • Default alert frequency (minutes) - the default frequency used when creating new log alerts.
  • Last scan date - how far back the log alert will look the next time it runs.

 

Deleting specific log entries

By default, nopCommerce gives you only two options for pruning your system log. You can use the Clear log button to delete every log entry from the system, or you can use the Delete selected button to delete individual log entries after checking the box next to each of them, which is time consuming and tedious. 

The Advanced Log plugin gives you a powerful third option - Delete Search Results

If your log is littered with hundreds or thousands of useless log entries, such as 404 errors generated by bots scanning your website, you can delete all of them with ease. Search for the messages you want to delete, for example "Error 400", and verify that only these messages appear in the results. Then simply click the Delete Search Results button to delete all the messages. 

 

Jump to page in the log

By default the nopCommerce system log allows you to navigate the log one page at a time. It gets very tedious finding when an issue started when there are thousands of records to page through. Instead of wasting time paging through hundreds of pages of log messages, simply enter the page number in teh Jump to page box, and click go. 

 

What advanced log features do you want?

Please share any ideas you would find useful that we could include in the next version of the Advanced Log plugin. 

Drop us a line on our contact page