WL#9552: Windows Event Log Plugin

Affects: Server-8.0   —   Status: Complete   —   Priority: Medium

Motivation

On Windows application messages can be logged in structured way in the Windows Application Events log, which allows users to search the log without much effort and integrate easily with other tools.

Description

Router currently report events such as errors, warnings, or informational events to a dedicated file, but in order to integrate with Windows it is critical that we can write the events to the Windows Application Events Log.

In order to be be useful it is necessary that the correct event type, event category, and event identifier is set for each event. This might require extending the logging functions with the necessary information.

Windows Application Events Log
https://docs.microsoft.com/en-us/windows/desktop/wes/windows-event-log
event type
https://docs.microsoft.com/en-us/windows/desktop/EventLog/event-types
event category
https://docs.microsoft.com/en-us/windows/desktop/EventLog/event-categories
event identifier
https://docs.microsoft.com/en-us/windows/desktop/EventLog/event-identifiers

Goal

  • send messages to the eventlog
  • allow to configure that message shall only be sent to the eventlog

Functional Requirements

FR1. A new "eventlog" built-in plugin should be introduced that can log events to the windows event log.

FR2. Any events logged shall be logged with the correct event type, where applicable. The DEBUG level messages shall be logged with INFORMATION type as Windows EventLog does not support DEBUG type.

FR3. Message source for all the messages logged by the Router should be "MySQL Router".

FR4. Single event category and event identifier is going to be used, so the message specifics and the module that logs the event will be contained in the Event Data.

FR5. In order to correctly display the log source as MySQLRouter in the Windows event log, the MySQLRouter binary needs to be added in the Windows registry. For that proper privileges are needed (system admin) when launching the Router for the first time after the eventlog logging has being added to the configuration.