RM offers an extended log management mechanism, which supports logs related to backend components and logs related to devices.

Overview

The RM system allows storing, getting and filtering of log messages coming from the registered devices and the backend system. Logs are short information messages describing the runtime performance of bundles, services and frameworks.

According to the OSGi Service Platform Specification, logs are managed by the OSGi Log Service. The specification defines log entries created by bundles and services. They have different severity levels depending on the type of event they notify. By default, the levels ERROR, WARNING, INFO and DEBUG are defined in the specification, but it is possible to introduce custom levels as well.

The RM system extends this mechanism allowing you to manage device and backend related logs. Such messages are filtered by the ID of the device or backend host that they give information about, by log message creator, etc. For example, if a log message is generated by a backend server but describes a device-related event, you will receive this message on filtering logs by the device ID.

For example, RM logs can give information about:

  • The operations and errors created by the bundles and services running on devices.
  • The performance of the bundles and services running on the control center and management servers.
  • The runtime performance of devices in the system - registration/unregistration of a device, a device goes online/offline, etc.
  • The success/failure of management operations, etc.


Installation and Setup

Logs are handled by the RM Backend Logs bundle (packages/system/log.jar) on the backend hosts' frameworks. This bundle is started by default so you only need to start it manually if you have explicitly stopped or uninstalled it.

Configuring the Backend Log Service

You can configure the RM Log Service through its configuration. In the console, it appears as Log Service Configuration located in the Configurations tab of the System Configuration dashboard view of the console. For further details about configuring backend bundles, refer to Backend Bundles Configuration.
The configuration provides the following properties:

Configuration Property

Type

Default Value

Description

Database Update Bunch Size

int

50

Specifies the maximum bunch of logs (JDBC batch size) inserted in a single update into the database when queued in the internal buffer.

Enable batch DB processing

boolean

true

Enables JDBC batch DB processing. Recommended to be set to true.

Disable Trivial Log Entries

boolean

true

Disables generation of log entries about trivial cases such as service events, bundle events, framework events and bundle changes.

Old Log Info Entries Removal Time

int

24

Specifies the period in hours over which RM will traverse the log storage and will delete all expired logs with INFO level. Set a value between 1 and 24 hours.

Log Info Entries Expiration Time

int

7

Contains the "age" of INFO log entries. If an entry is older than this age, it will be removed from the log storage within the Old Log Info Entries Removal Time interval.

All Old Log Entries Removal Time

int

24

Specifies the period in hours over which RM will traverse the log storage and will delete all expired logs. Set a value between 1 and 24 hours.

All Log Entries Expiration Time

int

70

Contains the general "age" of all log entries. If an entry is older than this age, it will be removed from the log storage within the All Old Log Entries Removal Time  interval.

Trivial Logs Severity Level

int

3

Contains the severity threshold of trivial log entries. If Disable Trivial Log Entries is true, entries with severity equal to or least than this one will be considered trivial and will not be saved to the log storage. By default, 3 (e.g. WARNING) is set which means that only errors will be persistently logged in RM.

Skip Duplicated Logs

true

false

If true, disables saving repeated logs from the same source.

Skip Interval

int

60

If Skip Duplicated Logs is true, specifies the time in seconds during which RM will not accept duplicate logs.

Trivial Values

String[]

Bundle|has been updated. Bundle|has been installed. Bundle|has been started. Bundle|has been uninstalled. Bundle|has been stopped. BundleEvent| ServiceEvent| FrameworkEvent| {CMEvent| {CMThread| {MetaData| {Config} Called update on pid=| [HTTP] [ServletContext]| [PSObjectClassCreator]| 

Contains key phrases that term logs with level satisfying the Trivial Logs Severity Level property as trivial. Each phrase has the semantics <start_phrase>|<end_phrase> where <start_phrase> stands for a phrase a trivial message starts with and <end_phrase> is a phrase a trivial message ends with. For example, if this property contains an entry "{MetaData|" and Trivial Logs Severity is equal to WARNING, RM will not log entries whose messages start with "{MetaData" and are warning, info or debug. 


Log Service Technical Properties

The Log Service technical properties are used for configuration of different file, database and formatting aspects of the log service functionality.
The table below contains all properties and their default values, if any:

Property

Default Value

File


mprm.log.file.only

false

mprm.log.file.maxLogSize

-

mprm.log.file.deviceLog.allInDefaultLog

-

mprm.log.file.deviceLog.inAllMatchingDeviceWriters

-

mprm.log.file.deviceTypeWriters.patterns

-

mprm.log.file.min.level

4 // LogService.LOG_DEBUG

mprm.log.file.writeBufferSize

500

mprm.log.file.waitOnEmptyQueueMS

5000

mprm.log.file.encryptIDs

-

mprm.log.file.formatter

plain

mprm.log.file.ext.format

yyyyMMdd-HHmmss

mprm.log.file.size

5

mprm.log.file.max.log.files

20

mprm.log.file.rotation.period

0

mprm.log.file.dir

../../logs

mprm.log.file.name

mprm.log

mprm.log.file.deviceId.format

[{device.type}/{device.id}]

mprm.log.file.dateformat.timezone

UTC

mprm.log.file.ext.formatPattern

\\.
d{8}-d{6}

mprm.log.file.category.format

[{category}]

mprm.log.file.level.format

[{level}]

Database


mprm.log.db

true

mprm.log.db.speedUpGetSystemLogs

true

mprm.log.db.defaultBufferSize

20

mprm.log.db.maxLogSize

1500

mprm.log.db.min.level

4 (LogService.LOG_DEBUG)

Formatting


mprm.log.sysout.maxLogSize

-

mprm.log.sysout.waitOnEmptyQueueMS

5000

mprm.log.sysout.min.level

4 (LogService.LOG_DEBUG)

mprm.log.sysout.formatter

plain


The code snippet below illustrates an example log.prs.

############################## Log Configuration ##############################
mprm.log.db=false
 
mprm.log.sysout=true
#mprm.log.sysout.formatter=json
### DEBUG=4, INFO=3, WARNING=2, ERROR=1
mprm.log.sysout.min.level=2
 
#mprm.log.file=false
#mprm.log.file.dateformat.pattern=[yyyy-MM-dd HH:mm:ss.SSS z]
#mprm.log.file.size=5
#mprm.log.file.max.log.files=20
#mprm.log.file.rotation.period=0
#mprm.log.file.dir=../../logs
#mprm.log.file.name=mprm.log
#mprm.log.file.deviceId.format=[{device.type}/{device.id}]
#mprm.log.file.dateformat.timezone=UTC
 
### DEBUG=4, INFO=3, WARNING=2, ERROR=1
#mprm.log.file.min.level=4
#mprm.log.file.ext.format=yyyyMMdd-HHmmss
#mprm.log.file.ext.formatPattern=\\.\\d{8}+-\\d{6}+
#mprm.log.file.category.format=[{category}]
#mprm.log.file.level.format=[{level}]


Audit Logging

Audit Logging allows following of user interactions with the system (what, when and by who). This information can be then used to analyze, reproduce or recover needed scenarios. In case of malicious action attempts the Remote Manager can be used as an important source of security information and responsibility transfer if the Remote Manager's clients have access to the system.

  • Time
  • User
  • Session ID (user session identifier will be used, no a RPC call session id)
  • Entry Point (REST / RPC)
  • Event Group / Tags
  • Event Type (ADD / REMOVE / CHANGE)
  • Event Description / Details

Configuration

Audit logging is turned ON by default with the file logging option. The following properties' values should be set in the default.prs file.

mprm.audit.log.sysout=true - log into the system out
mprm.audit.log.file=true - log into the filesystem
mprm.audit.file.name=<audit.log>
mprm.audit.file.dir=<mprm.log.location>
mprm.audit.file.rotation.period=<7> - one week is the default file rotation period, then the file is renamed and a new one is created
mprm.audit.file.max.size - max file size in MB
mprm.audit.file.max.number - max number of rotated files, e.g. if the rotation period is 7 days and the max number of files is 4, the audit log will be available for 28 days, which will also be the new default.

User Interface

With the console you can read all logs including both backend-generated and device-generated ones. The console can display only messages with the default log levels (ERROR, WARNING, INFO and DEBUG). See User Guide for more details about using the console for reading available log messages.