Megaladata Integrator Configuration

To configure Megaladata Integrator, use the Integrator.dll.config XML file. The default file location is %ProgramFiles%\Megaladata\Integrator.

Connecting to Megaladata server

Megaladata Integrator supports connections to multiple instances of Megaladata Server simultaneously.

The configuration element contains a settings element, where you can add the following attributes:

  • shutdownTimeout: Optional attribute that sets the timeout (in seconds) for shutting down the Integrator. If there are active requests when shutting down, the Integrator waits for the timeout before forcibly terminating all connections to the Megaladata Server. The Integrator doesn't accept new requests during this period. By default, the timeout is set to 30 seconds. If IIS uses its own timeout, the process terminates after the shorter of the two timeouts expires.

  • swaggerUI: Attribute that accepts true/false values to enable or disable the generation of the openapi/index.html page, which provides access to published services via Swagger UI. Swagger UI is used to create interactive API documentation and for easier testing. Setting this attribute to false does not disable access to the web services themselves.

  • urlPathPrefix: Optional attribute whose value is used as a prefix for all REST and SOAP endpoint addresses. Default value: empty string. For example, if Megaladata Integrator is deployed at http://localhost/mgi and the urlPathPrefix attribute is not specified, the help page is available at:
  • For REST: http://localhost/mgi/rest/help
  • For SOAP: http://localhost/mgi/soap?wsdl

If urlPathPrefix="abc", the address changes to:

  • For REST: http://localhost/mgi/abc/rest/help
  • For SOAP: http://localhost/mgi/abc/soap?wsdl

The description of a specific package will be located at:

  • For REST: /mgi/rest/<PackageName>/help or /mgi/abc/rest/<PackageName>/help
  • For SOAP: /mgi/soap/<PackageName> or /mgi/abc/soap/<PackageName>

For each Megaladata Server instance used, add a server element under configuration/settings with the following attributes:

  • unixsocket: Attribute that allows connection via Unix domain socket. Default value: C:\ProgramData\Megaladata\megaladatad.socket.
  • address: Network address of the Megaladata Server host. Required attribute. Default value: localhost.
  • port: TCP server port. Default value: 4580.
  • userName: Account name with service login rights. If not specified, the username and password of the service user are used.
  • password: Password for the account with service login rights. Default value: empty string.
  • reserved: If set to "true", marks the server as a backup.
  • packageRefreshPeriod: Interval (in seconds) at which the Integrator requests the list of published packages from the server. The Integrator compares this list with its own and applies any changes. If the parameter is not specified, the Integrator will not perform periodic package list requests.
Example config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="log" type="Integrator.Core.LogConfigurationSection, IntegratorCore" />
    <section name="megaladata" type="Integrator.Core.MegaladataConfigurationSection, IntegratorCore" />
  </configSections>
  <log>
    <fileSystem level="Info" maxArchiveFiles="30" encoding="utf-8" />
    <eventLog level="Off" />
    <database connectionString="Provider=SQLNCLI11;Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=MgiLog" level="Off" table="Logs" dateColumn="Date" levelColumn="Level" machineNameColumn="MachineName" appDomainColumn="AppDomain" requestIdColumn="RequestId" packageNameColumn="PackageName" nodeNameColumn="NodeName" messageColumn="Message" exceptionColumn="Exception" requestColumn="Request" responseColumn="Response" />
    <!--sqlCommand="insert into Logs (Date, Level, MachineName, AppDomain, RequestId, PackageName, NodeName, Message, Exception, Request, Response)
              values (:date, :level, :machinename, :appdomain, :requestid, :packagename, :nodename, :message, :exception, :request, :response)"/>-->
    <console level="Off" />
    <journald level="Off" maxEntrySize="65536" />
    <internal level="Error" />
  </log>
  <settings swaggerUI="true" urlPathPrefix="Service.svc">
    <server unixsocket="/run/megaladata/megaladatad.socket" address="localhost" port="4580" userName="service" password="service" />
    <!--<server address="localhost" port="4580" userName="service" password="service" reserved="true"/>-->
  </settings>
</configuration>

Megaladata Integrator maintains information about server availability and the packages published.

When it receives a request, the Integrator selects a random server from the available primary (non-backup) servers that provide the required package. If no server provides the package, the Integrator selects a random server from all the available backup servers.

Working directory

The working directory contains temporary data required for the application to function.

The default directory path is %ALLUSERSPROFILE%\Megaladata\Integrator. You can override this value in the workDir attribute of the configuration/settings element. The value can be an absolute or relative (to the configuration file) path.

If multiple instances of Megaladata Integrator are used, their working directories must be different.

Logging

Set the logging parameters in the configuration/log element.

The following modes are available:

  • fileSystem: log to file
  • eventLog: log to Windows Event Log
  • database: log to a database
  • internal: log to the logging event file (e.g., log the errors that occurred when logging to a database)

Each mode can be assigned a minimum detail level:

  • All
  • Trace
  • Debug
  • Info
  • Warn
  • Error
  • Fatal
  • Off (logging disabled)

By default, logging to a file is enabled with the Info detail level, and logs are written to the %ALLUSERSPROFILE%\Megaladata\Integrator\Logs\ directory.

Note: Logging of request body and service response text occurs at a logging level of Trace or higher.

Logging to file

Set the file logging parameters in the configuration/log/fileSystem element:

  • path: full or relative (to the working directory) path to the log directory. Default value: Logs.
  • maxArchiveFiles: maximum number of archived logs. The default value 0 means no limit.
  • level: minimum logging level. Default value: All.

The log file name is log.log.

The system creates new log files daily, renaming old log files as log.yyyy-MM-dd.log.

Logging to Windows event log

Windows Event Log parameters are set in the configuration/log/eventLog element:

  • level: Minimum logging level. Default value: All.

The event source in the Windows log is Megaladata Integrator.

Logging to database

Database logging parameters are set in the configuration/log/database element:

  • connectionString: Database connection string. Required attribute.
  • level: Minimum logging level. Default value: All.

You can map log fields to table fields or specify an SQL query using either the table or sqlCommand attribute, but not both.

Important: If you set both table and sqlCommand attributes, the Integrator will throw an error on startup.

Mapping to table fields

To map fields, specify the following attributes:

  • table: table name
  • dateColumn: field name for the event time
  • levelColumn: field name for the event level
  • machineNameColumn: field name for the NetBIOS hostname where the Integrator is running
  • userNameColumn: field name for the user running the Integrator process
  • appDomainColumn: field name for the application domain identifier
  • requestIdColumn: field name for the unique request identifier
  • packageNameColumn: field name for the executed package name
  • nodeNameColumn: field name for the executed node name
  • messageColumn: field name for the event text
  • exceptionColumn: field name for the error text
  • requestColumn: field name for the web service request body
  • responseColumn: field name for the web service response text

You can skip field name attributes or set them to empty values. In this case, the corresponding data will not be logged.

Example SQL script for creating a log table in MS SQL

/* Field sizes for nvarchar may need adjustment */
CREATE TABLE [dbo].[Logs](
    [Date] [datetime2](4),
    [Level] [nvarchar](10),
    [MachineName] [nvarchar](100),
    [AppDomain] [nvarchar](200),
    [RequestId] [nvarchar](32),
    [PackageName] [nvarchar](100) NULL,
    [NodeName] [nvarchar](100) NULL,
    [Message] [nvarchar](max) NULL,
    [Exception] [nvarchar](max) NULL,
    [Request] [nvarchar](max) NULL,
    [Response] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Example of mapping log fields to table fields in the <log> section of Integrator.dll.config
<!--Logging parameters are set in the log element-->
<log>
 <fileSystem level="Off" maxArchiveFiles="30" encoding="utf-8" path="C:\Logs"/>
 <eventLog level="Off" />
 <!--The database element contains database logging settings-->
    <!--The connectionString attribute contains the database connection string-->
    <!--This example uses the OLEDB driver for SQLServer (must be installed on the system)-->
    <database connectionString="Provider=sqloledb; Server=192.168.0.1; Database=Integrator; User Id=sa; Password=Password123" level="All" table="Logs" dateColumn="Date" levelColumn="Level" machineNameColumn="MachineName" appDomainColumn="AppDomain" requestIdColumn="RequestId" packageNameColumn="PackageName" nodeNameColumn="NodeName" messageColumn="Message" exceptionColumn="Exception" requestColumn="Request" responseColumn="Response"/>
 <internal level="Error" />
</log>

SQL query

To specify the SQL query, use the sqlCommand attribute.

Use the following parameters as placeholders in the query:

  • :date: event time
  • :level: event level
  • :machinename: netBIOS hostname where the Integrator is running
  • :username: username running the Integrator process
  • :appdomain: application domain identifier
  • :requestid: unique request identifier
  • :packagename: executed package name
  • :nodename: executed node name
  • :message: event text
  • :exception: error text
  • :request: web service request text
  • :response web service response text

Note: Using the userNameColumn attribute and the corresponding :username parameter significantly increases the logging time. Avoid using them unless necessary.

Example of logging fields using an SQL query in the <log> section of Integrator.dll.config
<!--Logging parameters are set in the log element-->
<log>
 <fileSystem level="Off" maxArchiveFiles="30" encoding="utf-8" path="C:\Logs"/>
 <eventLog level="Off" />
 <!--The database element contains database logging settings-->
    <!--The connectionString attribute contains the database connection string-->
    <!--This example uses the OLEDB driver for SQLServer (must be installed on the system)-->
    <!--The sqlCommand attribute specifies the query for logging the event-->
    <!--This method allows modifying log entries-->
    <!--In this example, the :response field content will be truncated to 1000 characters-->
    <database connectionString="Provider=sqloledb; Server=192.168.0.1; Database=Integrator; User Id=sa; Password=Password123" level="All" sqlCommand="insert into Logs (Date, Level, MachineName, AppDomain, RequestId, PackageName, NodeName, Message, Exception, Request, Response) values (:date, :level, :machinename, :appdomain, :requestid, :packagename, :nodename, :message, :exception, :request, SUBSTRING( :response, 0, 999))"/>
    <internal level="Error" />
</log>

Logging internal events

Set the internal event logging parameters in the configuration/log/internal element:

  • path: full or relative (to the working directory) path to the log directory. Default value: Logs.
  • level: minimum logging level. Default value: All.

The name of the log file is logger-internal.log.

Read on: Update Megaladata Integrator

results matching ""

    No results matching ""