---
title: Configure Nodinite Pickup Service Logging Agent for SQL Server Integration
description: Configure the Nodinite Pickup Service Logging Agent to collect custom Log Events from SQL Server. This guide provides step-by-step setup, best practices, and integration tips for secure, scalable, and reliable log event collection, including table structure and validation.
---

<!-- markdownlint-disable MD034 -->
:ReleaseNotes(https://portal.nodinite.com/marketplace/14):
<!-- markdownlint-enable MD034 -->

# :fa-edit: SQL Server Configuration Example

Easily integrate your enterprise systems by configuring the :Nodinite: [Pickup Logging Service][Pickup Service] to fetch [JSON Log Events][JSON Log Event] directly from your SQL Server database. This guide empowers you to set up secure, scalable, and reliable log event collection for your organization, with robust validation and table design for compliance and analytics.

* ✅ Seamless integration with SQL Server for real-time log event collection  
* ✅ Secure and compliant long-term storage of log data  
* ✅ Scalable configuration for enterprise environments  
* ✅ Automated validation and error handling for reliable operations  

<div class="mermaid">
graph LR
    subgraph "SQL Server"
        roS("fa:fa-database: Database Table")
    end
    subgraph "Nodinite instance"
        roPS("fa:fa-truck-pickup: Pickup Service")
        roS --> roPS
        roPS --> | Long term storage | roDB("fa:fa-database: Log Database")
    end
</div>

*The diagram above illustrates how the Pickup Service interacts with SQL Server tables, processes messages, and stores them in the :Nodinite: [Log Database][Log Databases].*  

>[!TIP]
>**Considering SQL Server for your log collection?** Review [SQL Server Pros and Cons][FAQ-Pros-And-Cons] to understand performance benefits, infrastructure trade-offs, and when to choose SQL Server vs. alternatives (HTTP [Log API][], [Azure Service Bus][], RabbitMQ).

## :fa-list: SQL Servers

The **SQL Servers** section lets you manage all SQL Server database sources for your log events.

In the [Remote Configuration][] GUI, navigate to the **SQL Servers** tab. Here, you can add, edit, or remove SQL Server database configurations. Each configuration defines how the :Nodinite: [Pickup Log Events Logging Service][Pickup Service] connects to and processes messages from a specific SQL Server database table.

![SQL Servers Configuration Tab][1]  
*Example of the SQL Servers configuration tab in the [Remote Configuration][] GUI.*

Click the **Add** button to create a new SQL Server configuration. Fill in the required fields, such as connection string, database name, and row limit settings. You can also configure Replace Rules for advanced message processing.

![SQL Server Configuration Accordion][2]  
*Example of a SQL Server configuration accordion in the [Remote Configuration][] GUI.*

Expand the accordion for each SQL Server configuration to access advanced settings, including [Replace Rules][ReplaceRules] for message processing. These rules allow you to modify message content before it's stored in :Nodinite:, ensuring consistency and compliance with your logging standards.

>[!IMPORTANT]
>Ensure that your SQL Server database user has read access to the LogEvents table and update permissions to set the ValidationFailed flag. Test connectivity before enabling a configuration.

### General tab

The **General tab** provides the fundamental settings for your SQL Server configuration within the [Remote Configuration][] GUI.  
  ![General Tab][3]  
  *The General tab allows you to enable/disable the configuration and provide a display name and description.*

The following key fields are required:

|Field|Description|Required|Notes|  
|---|---|---|---|  
|:fa-toggle-on: **Enabled**|Checkbox to activate or deactivate this SQL Server configuration|No|When unchecked, the Pickup Service will skip this configuration|  
|:fa-tag: **Display Name**|User-friendly name for this SQL Server source configuration|✅ Yes|Used in the GUI and logs for easy identification|  
|:fa-align-left: **Description**|Optional detailed description of the SQL Server configuration|No|Helps document the purpose and details of this specific database setup|  

Follow these guidelines when configuring the General tab:

* Use descriptive names that clearly indicate the database and purpose (e.g., "Production DB - Order Events")
* In the Description field, note important details such as the database's business purpose, owner contact, or any special processing notes
* The Display Name appears throughout the :Nodinite: interface, so keep it concise yet meaningful
* Leave the configuration disabled during initial setup if you're not ready to start collecting log events

### Source tab

The **Source tab** contains the database connection configuration and query settings.  
  ![Source Tab][4]  
  *The Source tab contains settings for connecting to the SQL Server database.*

The following key fields must be configured for database connectivity:

|Field|Description|Required|Notes|  
|---|---|---|---|  
|:fa-plug: [Connection String][SQL Connection Strings]|SQL Server connection string with authentication|✅ Yes|Example: `Server=myServerAddress;Database=myDataBase;Integrated Security=True;Connection Timeout=60;TrustServerCertificate=true`|  
|:fa-hashtag: **Max Rows Limit**|Maximum number of rows to fetch per query execution|No|Default: 500; higher values may impact memory usage; adjust based on your environment|  

Follow these guidelines when setting up the Source tab:

* Ensure your database user has SELECT permissions on the LogEvents table and UPDATE permissions to flag invalid records
* Use connection strings with encryption and certificate validation for production environments
* Test the connection before enabling to verify credentials and database accessibility
* Set Max Rows Limit based on available server memory and network bandwidth
* For large datasets, start with 500 rows and adjust upward after testing
* Include proper timeout and retry settings in your connection string
* Use strong, unique passwords and store them securely
* Never embed credentials directly in documentation or version control

### Destination tab

The **Destination tab** settings are shared across all source configurations. See [Destination Tab][] in the shared configuration guide.

### Replace Rules

Read about [Replace Rules][ReplaceRules] in the shared configuration section. Replace Rules allow you to modify message content before it's stored in :Nodinite:, ensuring consistency and compliance with your logging standards.
  ![Replace Rules Tab][6]  
  *The Replace Rules tab allows you to configure rules for modifying message content.*

## :fa-file: Configuration file  

>[!NOTE]
>This section applies for **older** versions (<7.1.x) of the :Nodinite: [Pickup Log Events Logging Service][Pickup Service].

```cmd
C:\Program Files\Nodinite\Logging Agent - Pickup Service\Settings.json
```

```json
{
  ...
  "SQLServers": [
    {
      "Enabled": true,
      "LogApi": "https://nodinite.contoso.com:40002/LogAPI/",
      "UseConfigurationDatabase": false,
      "ConfigurationDatabaseConnectionString": null,
      "ConnectionString": "Server=myServerAddress;Database=myDataBase;Integrated Security=True;Connection Timeout=60;TrustServerCertificate=true",
      "MaxRowsLimit": 500,
      "ReplaceRules": [
        {
          "Name": "Fix Endpoint real customer id to {customerId}",
          "ReplaceName": false,
          "ReplaceUri": true,
          "Pattern": "/([0-9]{4,})$",
          "Group1Value": "{customerId}"
        }
      ]
    }
  ]
  ...                      
}
```

**SQL Servers** is an **array** of SQL Server configurations. Each entry defines how the [Log Agent][Log Agents] connects to and processes messages from a specific SQL Server database. This setup ensures your :Nodinite: [JSON Log Events][JSON Log Event] are reliably collected and managed.  

|Property|Description|Value Example|Comment|  
|---|---|---|---|  
|:fa-plug: **ConnectionString**|SQL Server connection string (uses **Microsoft.Data.SqlClient** with modern TLS defaults)|`Server=myServerAddress;Database=myDataBase;Integrated Security=True;Connection Timeout=60;TrustServerCertificate=true`|See [SQL Server Connection Strings][SQL Connection Strings] for certificate validation, AOAG, troubleshooting, and security|  
|:fa-hashtag: **MaxRowsLimit**|Maximum number of rows to fetch on each loop|500 (default)|Larger values may impact memory usage|  
|:fa-toggle-on: **Enabled**|See the [Shared Configuration][] section for more info|||  
|:fa-link: [LogAPI][Log API]|See the [Shared Configuration][] section for more info|||  
|:fa-database: **UseConfigurationDatabase**|See the [Shared Configuration][] section for more info|||  
|:fa-plug: **ConfigurationDatabaseConnectionString**|See the [Shared Configuration][] section for more info|||  
|:fa-exchange-alt: **ReplaceRules**|See the shared [Replace Rules][ReplaceRules] section for more info|||  

>[!IMPORTANT]
>When you are done editing the configuration, you must restart the :Nodinite: [Pickup Logging Service][Pickup Service] for configuration changes to take effect.  

## :fa-database: SQL Server Table

If you use a [Microsoft SQL Server][] database to store [Log Events][Log Event], your custom logging solution must define the following **LogEvents** table:  

|Column|Datatype|Purpose|  
|---|---|---|  
|:fa-file-lines: **LogEvent**|json|Your [JSON encoded Log Event][JSON Log Event]|  
|:fa-fingerprint: **Id**|bigint|Automatically created identity; the PickupService must know which row to flag as invalid if the value in **LogEvent** is not valid|  
|:fa-circle-exclamation: **ValidationFailed**|boolean|Automatically set to **false** when inserted; may be set to **true** during processing if errors are detected|  
|:fa-align-left: **ValidationFailedText**|text|Updated if errors occur validating the LogEvent during processing|  
|:fa-calendar-day: **Created**|timestamp|Automatically created during insert; useful for troubleshooting|  

>[!IMPORTANT]
>Invalid [Log Events][Log Event] will have **`ValidationFailed`** set to **`True`**. You must remove these entries **manually**.  

```sql
-- Table: [LogEvents], used by :Nodinite: Logging

-- DROP TABLE [dbo].[LogEvents];

CREATE TABLE [dbo].[LogEvents](
    [Id] [bigint] IDENTITY(1,1) NOT NULL,
    [LogEvent] [nvarchar](max) NOT NULL,
    [ValidationFailed] [bit] NOT NULL,
    [ValidationFailedText] [nvarchar](max) NULL,
    [Created] [datetimeoffset](7) NOT NULL,
 CONSTRAINT [PK_LogEvents] PRIMARY KEY NONCLUSTERED 
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF, DATA_COMPRESSION = PAGE) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

-- Drop existing nonclustered primary key if needed and recreate as clustered
-- Or keep it and add this covering index
CREATE NONCLUSTERED INDEX [IX_LogEvents_ValidationFailed_Created_Id]
ON [dbo].[LogEvents] ([ValidationFailed], [Created], [Id])
INCLUDE ([LogEvent])
WITH (FILLFACTOR = 100, DATA_COMPRESSION = PAGE, ONLINE = OFF);

ALTER TABLE [dbo].[LogEvents] ADD CONSTRAINT [DF_LogEvents_ValidationFailed]  DEFAULT ((0)) FOR [ValidationFailed]
GO

ALTER TABLE [dbo].[LogEvents] ADD CONSTRAINT [DF_LogEvents_Created]  DEFAULT (sysutcdatetime()) FOR [Created]
GO

IF TYPE_ID(N'dbo.IdList') IS NULL EXEC(N'CREATE TYPE dbo.IdList AS TABLE (Id BIGINT NOT NULL);');
GO

GRANT DELETE ON OBJECT::dbo.LogEvents TO [DEV\N-Svc-gMSA$]; -- Replace with proper service account
GO

GRANT EXECUTE ON TYPE::dbo.IdList TO [DEV\N-Svc-gMSA$]; -- Replace with proper service account
GO

-- Do not forget to assign user access rights
```

>[!IMPORTANT]
>Remember to grant the service account for the Pickup Service the following database rights:

**Recommended database rights** — Grant the Pickup Service account the minimum required roles below. Use the table to map permissions to purpose and official documentation.

|Permission|Purpose|Microsoft Docs|  
|---|---|---|  
|:fa-eye: **db_datareader**|Grants read access to all tables and views (required to fetch LogEvent rows and related metadata).|[db_datareader](https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/database-level-roles?view=sql-server-ver15#db_datareader)<sup>:fa-arrow-up-right-from-square:</sup>|  
|:fa-pen: **db_datawriter**|Grants write access to all tables and views (used when Pickup Service updates status or flags rows).|[db_datawriter](https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/database-level-roles?view=sql-server-ver15#db_datawriter)<sup>:fa-arrow-up-right-from-square:</sup>|  
|:fa-screwdriver-wrench: **db_ddladmin**|Allows running DDL statements and creating table types (required when the Pickup Service uses table-valued parameters or creates temp objects).|[db_ddladmin](https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/database-level-roles?view=sql-server-ver15#db_ddladmin)<sup>:fa-arrow-up-right-from-square:</sup>|  

## :fa-pen: How to Insert a Log Event

Insert [Log Events][Log Event] into the **LogEvents** table using the JSON structure from the [Log API][] Swagger documentation. The example below demonstrates a complete insert with validation and date handling.

>[!TIP]
>Copy the JSON payload from the [Log API][] Swagger UI at `https://{host}:{port}/swagger` to ensure your Log Event structure matches the current API schema.

```sql
DECLARE @LogEvent nvarchar(max) = N'{
  "LogAgentValueId": 42,
  "EndPointName": "INT101: Receive Hello World Log Events",
  "EndPointUri": "C:\\temp\\in",
  "EndPointDirection": 0,
  "EndPointTypeId": 60,
  "OriginalMessageTypeName": "Hello.World.File/1.0",
  "EventDirection": 17,
  "LogDateTime": "2026-02-20T08:56:43.8122584+00:00",
  "ProcessingUser": "DOMAIN\\\\user",
  "SequenceNo": 0,
  "EventNumber": 0,
  "LogText": "File OK",
  "ApplicationInterchangeId": "",
  "LocalInterchangeId": "00000000-0000-0000-0000-000000000000",
  "LogStatus": 0,
  "ProcessName": "My Process",
  "ProcessingMachineName": "localhost",
  "ProcessingModuleName": "INT101-HelloWorld-Application",
  "ProcessingModuleType": "FilePickup",
  "ServiceInstanceActivityId": "00000000-0000-0000-0000-000000000000",
  "ProcessingTime": 80,
  "Body": "eyJvcmRlcmlkIjoiMTIzIiwibmFtZSI6IkpvaG4gRG9lIn0=",
  "Bodies": null,
  "Context": {
    "CorrelationId": "064205E2-F7CF-43A6-B514-4B55536C2B67",
    "ExtendedProperties/1.0#Filename": "HelloWorld.json"
  }
}';

DECLARE @Created datetimeoffset(7) =
    TRY_CAST(JSON_VALUE(@LogEvent, '$.LogDateTime') AS datetimeoffset(7));

INSERT INTO dbo.LogEvents
(
    LogEvent,
    ValidationFailed,
    ValidationFailedText,
    Created
)
VALUES
(
    @LogEvent,
    IIF(ISJSON(@LogEvent) = 1, 0, 1),
    IIF(ISJSON(@LogEvent) = 1, NULL, N'Invalid JSON payload'),
    COALESCE(@Created, SYSUTCDATETIME())
);
```

**Key points:**

* **Body field** - Base64-encoded payload (example decodes to `{"orderid":"123","name":"John Doe"}`)
* **LogDateTime** - ISO 8601 format with timezone offset (`YYYY-MM-DDTHH:MM:SS.FFFFFFF+HH:MM`)
* **Validation** - The `ISJSON()` function automatically flags invalid JSON during insert
* **Created timestamp** - Falls back to `SYSUTCDATETIME()` if `LogDateTime` cannot be parsed

>[!NOTE]
>The [Pickup Service][] processes Log Events in the order they appear in the table. Ensure your **Created** timestamp accurately reflects event timing for proper chronological processing.

## :fa-stethoscope: Monitoring Log Processing Health

This section describes using the :Nodinite: [Database Monitoring Agent][] (a separate monitoring component) to track the health of log event processing in the Pickup Service. While the Pickup Service handles **logging** (collecting and storing log events), you use [Monitor Agents][] to ensure the logging infrastructure is functioning properly.

### Monitor failed LogEvents

Detect failed LogEvents early to prevent processing backlogs, data loss, and compliance gaps. Use the :Nodinite: [Database Monitoring Agent][] to monitor the **LogEvents** table for failed entries with automated, continuous monitoring and instant alerts.

**See the complete guide:** [How to Monitor Failed LogEvents][FAQ-Monitoring] (includes T-SQL stored procedures, configuration steps, threshold settings, and testing recommendations)

### Purge failed LogEvents

Remove invalid LogEvents safely to avoid unbounded table growth and keep your Pickup Service processing healthy. Use batch deletion procedures to minimize locking and transaction log impact.

**See the complete guide:** [How to Purge Failed LogEvents][FAQ-Maintenance] (includes T-SQL batch deletion procedures, dry-run testing, scheduling recommendations, and safety best practices)

### Test Data Generation

Generate realistic test data to validate your SQL Server configuration, performance test large message scenarios (4MB+ payloads), and simulate high-volume logging.

**See the complete guide:** [How to Generate Test Data][FAQ-Testing] (includes T-SQL scripts for creating test LogEvents with configurable volumes and message sizes)

## :fa-hand-point-right: Next Steps

* :fa-cog: [Configure][Configuration] - Set up your SQL Server integration  
* :fa-book: [Remote Configuration Guide][Remote Configuration] - Learn the GUI setup process  

## :fa-link-horizontal: Related Topics

* :fa-file-code: [JSON Log Event][] - Message format specification  
* :fa-exchange-alt: [Replace Rules][ReplaceRules] - Transform message content  
* :fa-balance-scale: [SQL Server Pros and Cons][FAQ-Pros-And-Cons] - When to use SQL Server vs. alternatives  
* :fa-stethoscope: [Monitor Failed LogEvents][FAQ-Monitoring] - Automated monitoring with Database Monitoring Agent  
* :fa-broom: [Maintenance and Purging][FAQ-Maintenance] - Safe batch deletion procedures  
* :fa-vial: [Testing and Test Data][FAQ-Testing] - Generate realistic test data for performance testing  

[1]:{ndm}/Documentation%20Pictures/LogAgent/PickupService/Configuration/SQL/SQLServersTab.png
[2]:{ndm}/Documentation%20Pictures/LogAgent/PickupService/Configuration/SQL/EmptyAccordion.png
[3]:{ndm}/Documentation%20Pictures/LogAgent/PickupService/Configuration/SQL/GeneralTab.png
[4]:{ndm}/Documentation%20Pictures/LogAgent/PickupService/Configuration/SQL/SourceTab.png
[6]:{ndm}/Documentation%20Pictures/LogAgent/PickupService/Configuration/SQL/ReplaceRulesTab.png

[Azure Service Bus]:{ndr}/Logging%20and%20Monitoring/Message%20Queueing/Features/Azure%20Service%20Bus%20Queues/Monitoring%20Azure%20Service%20Bus%20Queue.md
[Configuration]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Getting%20started/3.%20Configuration.md
[Database Monitoring Agent]:{ndr}/Logging%20and%20Monitoring/Database/Overview.md
[Destination Tab]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Getting%20started/3.%20Configuration.md#fa-right-from-bracket-destination-tab
[FAQ-Maintenance]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Features/Configurations/Troubleshooting/FAQ%20-%20SQL%20Server%20-%20Maintenance.md
[FAQ-Monitoring]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Features/Configurations/Troubleshooting/FAQ%20-%20SQL%20Server%20-%20Monitoring.md
[FAQ-Pros-And-Cons]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Features/Configurations/Troubleshooting/FAQ%20-%20SQL%20Server%20-%20Pros%20and%20Cons.md
[FAQ-Testing]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Features/Configurations/Troubleshooting/FAQ%20-%20SQL%20Server%20-%20Testing.md
[JSON Log Event]:{ndr}/Core%20Services/Log%20Event/Features/JSON%20Log%20Event.md
[Log Agents]:{ndr}/Administration/1.%20Log%20Management/3.%20Log%20Agents/Features/What%20is%20a%20Log%20Agent.md
[Log API]:{ndr}/Core%20Services/Log%20API/Overview.md
[Log Databases]:{ndr}/Administration/5.%20Settings/2.%20Log%20Databases/Overview.md
[Log Event]:{ndr}/Core%20Services/Log%20Event/Overview.md
[Microsoft SQL Server]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/SQL%20Server%20Options.md
[Monitor Agents]:{ndr}/Administration/2.%20Monitor%20Management/2.%20Monitor%20Agents/Features/What%20is%20a%20Monitor%20Agent.md
[Pickup Service]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Overview.md
[Remote Configuration]:{ndr}/Administration/2.%20Monitor%20Management/2.%20Monitor%20Agents/Features/How%20do%20I%20configure%20a%20Monitor%20Agent.md
[ReplaceRules]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Getting%20started/3.%20Configuration.md#fa-exchange-alt-replace-rules-clean-up-your-dynamic-endpoints-automatically
[Shared Configuration]:{ndr}/Logging%20and%20Monitoring/Pickup%20LogEvents%20Service/Getting%20started/3.%20Configuration.md#fa-circles-overlap-shared-configuration
[SQL Connection Strings]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Connection%20Strings.md