Notification Logger
Use Case
The Notification Logger enables saving of notifications in a database so the they can be used for analyzing firmware and applications. Saved notifications can be queried via RSC interfaces.
The Logger Archives offer functions for acquiring and filtering of incoming notifications as well as for requesting and deleting. Using different archives makes it possible to save notifications for different issues and purposes, e.g.:
- Firmware diagnostics
Short-term saving of firmware events for diagnostics by the service. - Network diagnostics
Saving of diagnostic messages from network components over a short period for diagnosing disconnections or sporadic delays. - Application diagnostics
Saving notifications of the application program, e.g., malfunctions of machines, refilling consumables, error messages by integrated aggregates.
Concept
The Notification Logger registers with the Notification Manager for all configured notifications and thus receives all applicable messages that are sent. The saved notifications can be queried, displayed and evaluated using external tools, such as RSC services.
How to
Displaying notifications
The notifications that are present on a controller are displayed in PLCnext Engineer and in the Web-based Management on the controller.
In PLCnext Engineer
- In the PLANT area, click on the controller (e.g., AXC F 2152)
- Select the Cockpit editor
- Select Notifications
For detailed information, please refer to the online help of PLCnext Engineer.
In the Web-based Management
- Log in to the Web-based Management
- Open the Diagnostics section in the navigation on the left
- Select the Notifications entry
For detailed information, see Diagnostics - Notification Logger.
Receiving notifications
A Logger Archive subscribes to all notifications to be received. Additionally, in an archive, filters can be used for the notifications subscribed to that refer to their metadata. This way, you can select which notifications are actually saved. The Notification Logger contains several archives that enable notifications to be saved for different issues and purposes.
Using the Notification Logger in C++ programs
The PLCnext Technology SDK contains helpful classes for the Notification Logger. If you want to use a class, integrate it into your program via an #include
command, (e.g., #include Arp/Services/NotificationLogger/Services/INotificationLoggerService.hpp
).
INotificationLoggerService2
.Further information on the classes and their applications is available directly in the API documentation.
Configuring the Notification Logger
If you do not create your own configuration, the standard settings from the firmware settings file will be used. If necessary, you can configure the Notification Logger via a config file in XML format. You find the configuration files in the /opt/plcnext/projects/Default/Services/NotificationLogger/*.config directory. To modify the configuration manually, the XML file can be edited using any text or code editor. The configuration files are imported during the start of the firmware. Changes to the configuration are automatically applied after a restart of the controller.
Reference
Notification Logger configuration
Configure the Notification Logger by including the path to configuration files and defining archives.
Integrating configuration files
Configuration files are integrated between the <Includes>
and </Includes>
tags.
Use the Include path
attribute to reference further files to be integrated by indicating their path. The element can occur any number of times.
Defining an archive
Define an archive between the <Archives>
and </Archives>
tags using the following attributes:
Attribute | Description | ||
Archive name |
Name of the archive. The name is used as a basis for the file names. | ||
Notification name |
Name of the notification to be saved to the archive. This element can occur any number of times. | ||
ExclusionFilter |
Specification of the input filter for notifications. This can refer to any part of the namespace. All subordinate notifications are recorded. All notifications matching the filter are discarded and not saved. | ||
And |
AND link of several filter elements. Contains any number of other filter elements |
||
Or |
OR link of several filter elements. Contains any number of other filter elements |
||
Not |
Negation of a filter element. Contains exactly one other filter element | ||
NotificationName |
Regex attribute: Regular expression for the notification name |
||
SenderName |
Regex attribute: Regular expression for the sender name of the notification |
||
Severity |
operator attribute: comparison functions are GT, GE, LT, LE, EQ;threshold attribute: comparison values are Default , Info , Warning , Error , Critical , Fatal
|
||
Storage |
Specification of the persistent storage of the archive | ||
path |
Path for saving the archive files | ||
SizeLimitation |
Limitation of file size | ||
→ FilesizeLimitation |
MaxFilesize attribute: Maximum storage space in bytes; positive integer required, permitted suffixes are kB (*1024), MB (*1048576) |
||
SizeReduction |
Action for reducing the file size. The action is executed as soon as SizeLimitation is violated. |
||
→ DeleteOldestEntries |
NumberOfEntriesToDelete attribute: Number of elements to be deleted, positive integer |
Example
A configuration file for the Notification Logger is structured as shown in the following example:
<?xml version="1.0" encoding="UTF-8"?>
<NotificationLoggerConfigurationDocument
xmlns="http://www.phoenixcontact.com/schema/notificationloggerconfiguration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.phoenixcontact.com/schema/notificationloggerconfiguration"
schemaVersion="1.0">
<Includes>
<Include path="$ARP_PROJECTS_DIR$/Default/" />
</Includes>
<Archives>
<Archive name="Default"
<Notifications>
<Notification name="Arp" />
</Notifications>
<ExclusionFilter>
<Severity Operator="LE" Threshold="Info" />
</ExclusionFilter>
<Storage path="$ARP_PROJECTS_DIR$/Default/Services/NotificationLogger/archives">
<SizeLimitation>
<FileSizeLimitation MaxFileSize="64MB" />
</SizeLimitation>
<SizeReduction>
<DeleteOldestEntires NumberOfEntriesToDelete="16" />
</SizeReduction>
</Storage>
</Archive>
</Archives>
</NotificationLoggerConfigurationDocument >
Saving notifications
The Notification Logger uses one or several archives for registering, saving and querying notifications. It provides a uniform interface to these archives and enables the configuration of the archives via the configuration files.
The notifications are permanently stored in an SQLite database. This way, the file is not system-oriented and, after copying it to another system, can be opened and processed with the appropriate tools. The predefined databases are available on the file system of your controller at /opt/plcnext/logs/default.sqlite*.sqlite.