Table of Contents
Last updated: 2024-11-14

Host node logging


For the ShareAspace host node there are two logging channels, one is the configurable ShareAspace file logger and the other is the Microsoft Windows event log.

The Microsoft Windows event log channel focuses on the operations around the service and its maintainability.

The configurable file logger gives a more detailed informational log for the inner operations of ShareAspace. The detailed logging can be re-configured at runtime in order to include more details for a specific component.

File log


The ShareAspace file logger logs information to a text file in a JSON structured format.

  • The log files can be found in the System/Logs folder (e.g. F:\System\Logs).
  • Once a log file reaches a file size limit of 300MB the logging framework will automatically archive the log to a ZIP.

Configuration

Log levels and log component filtering can be configured in the appsettings.json file for the ShareAspace Service Host.

The log level can be set per namespace.

Supported log levels: Trace, Debug, Information, Warning, Error, Critical, None.

In the example below all Eurostep specific log entries are configured to use the Information log level. While the specific category Eurostep.SAS.FileSystem is configured to use the Debug log level.

  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Information",
      "Eurostep": "Information",
      "Eurostep.SAS.FileSystem": "Debug"
    }
  },

Log entry format example

{
  "lvl": "info",
  "eid": 6,
  "en": "CreateFileAction",
  "tim": "2021-05-04T06:43:31.1339263Z",
  "msg": "Create file action id: 2, container: nova_root, file name: /DX/Tasks/SharePackRevoke/index.json, created: 5/4/2021 6:43:31 AM, contentType: application/json, blob id: 2, md5: 237b53df58edcef095e478855f023e52.",
  "cat": "Eurostep.SAS.FileSystem.Internal.Actions.DefaultCreateFileAction",
  "scp": [
    {
      "SpanId": "5261a2abc5e98441",
      "TraceId": "ab8877489db91742bd79d5f78e778d15",
      "ParentId": "0000000000000000"
    },
    { "ConnectionId": "0HM8EOVM43SJ8" },
    {
      "RequestId": "0HM8EOVM43SJ8:00000002",
      "RequestPath": "/system/bootstrap/collection"
    }
  ],
  "ste": [
    {
      "fileId": 2,
      "containerName": "nova_root",
      "fileName": "/DX/Tasks/SharePackRevoke/index.json",
      "created": "05/04/2021 06:43:31",
      "contentType": "application/json",
      "blobId": 2,
      "contentMd5": "237b53df58edcef095e478855f023e52"
    }
  ]
}

Windows event log


When installing the Host on a server using the MSI package for the host, the MSI will setup the Windows Event Log for the Host.

The logs can be found under "Applications and Services Logs/Eurostep/Nova/Core" using the Windows Event Viewer.

Event Viewer

DataExchange logs

At the moment all messages (Information/Warning/Error/Critical) from jobs in data exchange (i.e. imports and exports) will be found in: Applications and Services Logs/Eurostep/Nova/Core/Admin, not to be mixed up with the dx-job log and the summary log for a job. The kind of data exchange messages that will be found here is when a job/task started/ended/canceled/failed/staged/succeeded and also errors that occur.

Web UI logs

Errors and warnings that occur in the Web-UI will be displayed on a pop-up on top of the screen.

In the example below a global uniqueness error/warning can be seen, first how it appears in the Web-UI and then how it appears in the Event Viewer.

The id in the Web-UI message is a correlation id that correlate to the correct message in the event viewer, see the CorrelationId in the event viewer.

Global uniqueness error in web

Global Uniqueness Error In Web

Global uniqueness error in event viewer

Global Uniqueness Error In Event Viewer

In the example above the error was really a warning meaning that it is an expected error. When we get Exception i.e. unexpected errors a stack trace will be visible in the Event Viewer log but not in the Web-UI log.

Unhandled exception


When using the REST APIs and there is an unhandled exception in the Host, the API will return a 500 response code and a message with a unique key. The exception itself is not leaked out to the client.

By providing the system administrator with this key - the administrator will be able to find the event log entry corresponding to this key by searching the Windows Event Log.

Example Exception

Note

Further reading about the technology and patterns on behind the logging capabilities in a Host can be found here.

Object logging


The object logging in ShareAspace track changes to instances, e.g. when a new instance is created or when an existing is updated or deleted. The log is aggregated and written on commit i.e. one log message per commit. The log message will specify the number of each operation Add, Update and Delete for each instance type.

The log is currently written to the Windows Event Log and can be viewed in the Windows Event Viewer. The logs will be found in the Application section of Windows Logs.

Object Logs Location

The log message contain:

  • Category "NovaObjectLogging"
  • Space id if applicable
  • User email of the user responsible for the commit
  • Timestamp when the request was initiated
  • Number of Add of each object type
  • Number of Update of each object type
  • Number of Delete of each object type

Object Logging Example

Set up

The object logging is enabled by default. It is possible to explicitly enable or disable logging by adding the property objectLogging to the collection bootstrap configuration file as shown below.

 "objectLogging": {
   "isEnabled": true
 }

When the isEnabled property is set to false the object logging will be disabled.

Note

The objectLogging property in the collection bootstrap configuration file is only applied when running the collection bootstrap application. For a system already running, the rest service described below is a better way to handle the logging availability.

Logging availability

The default status of the object logging is enabled unless the collection bootstrap disabled it but there is a way to enable and disable the object logging using a REST API POST call to the admin API.

To be able to make the admin API call the administration API symmetric key from the collection bootstrap configuration file is needed. With the admin API key it is possible to create a authorization header described in the admin API section of the documentation.

The route used to disable the object logging is:

POST: /admin/logging/object/disable

The route used to enable the object logging is:

POST: /admin/logging/object/enable

Below is a PowerShell example how to enable and disable object logging. The examples below needs to run on the actual server where the host is installed.

Turn off object logging example

Download turn-off-object-logging.ps1

$key = "--AdministrationSymetricApiKey--"
$path = "/admin/logging/object/disable"
$uri = "https://localhost:5001" + $path

$headers = GetAuthorizationHeader $key $path
Invoke-RestMethod -Method Post -Uri $uri -Headers $headers

Turn on object logging example

Download turn-on-object-logging.ps1

$key = "--AdministrationSymetricApiKey--"
$path = "/admin/logging/object/enable"
$uri = "https://localhost:5001" + $path

$headers = GetAuthorizationHeader $key $path
Invoke-RestMethod -Method Post -Uri $uri -Headers $headers