---
title: Nodinite Serilog Log API Sink
description: Learn how to use the Nodinite Serilog Log API sink to enable synchronous end-to-end tracking from Azure Functions and .NET applications via the Nodinite Log API, including the NodiniteApiUrl breaking change in version 7.10.9.
---

<a class="nodinite-release-notes" href="https://portal.nodinite.com/marketplace/15" data-url="https://portal.nodinite.com/marketplace/15"><i class="fal fa-fw fa-file-alt" aria-hidden="true"></i> Release Notes</a>

# <i class="fal fa-display" aria-hidden="true"></i> Nodinite Serilog sink using Nodinite Log API

Use the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Serilog sink for the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> [Log API][] with your full framework and .NET Core applications to **enable end-to-end tracking**. Typical examples include [Microsoft Azure functions][] built with .NET (usually CSharp). <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> supports payload Logging and removes the obstacle that Application Insights logging imposes on message size.

<aside aria-label="Important" class="nodinite-note nodinite-note--important">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-message-exclamation"></i> Important</p>
<div class="nodinite-note__content"><p><strong>Set OriginalMessageType for searchable business data</strong> - The Log API sink sends your log events synchronously to the Nodinite Log API for immediate processing. Without proper <a href="https://docs.nodinite.com/repository-model/message-types/overview/">Message Types</a>, your logged events won't have business data extraction via <a href="https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/overview/">Search Field Expressions</a>, preventing features like <a href="https://docs.nodinite.com/logging-and-monitoring/non-events/overview/">Non-Events Monitoring</a>, <a href="https://docs.nodinite.com/repository-model/bpms/overview/">Business Process Modeling (BPM)</a>, and business-data searches in <a href="https://docs.nodinite.com/administration/log-management/log-views/features/what-is-a-log-view/">Log Views</a> from functioning. Always include <code>OriginalMessageType</code> in your logging code before deploying to production. <strong>Log API sink provides synchronous logging with immediate confirmation but requires direct network connectivity to Nodinite.</strong></p></div>
</aside>

<aside aria-label="Warning" class="nodinite-note nodinite-note--warning">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-triangle-exclamation"></i> Warning</p>
<div class="nodinite-note__content"><p><strong>BREAKING CHANGE in version 7.10.9</strong> - When you update the <code>Nodinite.Serilog.ApiSink</code> package to version 7.10.9 or later, you must change the <code>NodiniteApiUrl</code> setting to the complete <a href="https://docs.nodinite.com/core-services/log-event/overview/">Log Event</a> address of your <a href="https://docs.nodinite.com/core-services/log-api/overview/">Log API</a>, ending in <code>/api/LogEvent</code>. The sink no longer adds anything to the address you configure. Read more in <a href="#log-event-address-nodiniteapiurl">Log Event address (NodiniteApiUrl)</a>.</p></div>
</aside>

<div class="mermaid">
graph LR
    A[.NET Application] --> | Log Event | SLS(Serilog)  
    F[fal:fa-function Azure Function] --> | Log Event | SLS  
    LA[fal:fa-cloud-arrow-down Nodinite Log API]
    SLS --> SLSB[fa:fa-list Api Sink]
    SLSB --> | Sync | LA  
</div>

## Logging Options

Choose one of the following articles based on the solution you want to enable Logging for:

❔['How To Start Logging With Microsoft.Extensions.Logging.ILogger in Azure Functions'][Serilog - ILogger]  
❔['How To Start Logging With Serilog'][Serilog - Logger]  

## Connection Options

Regardless of your choice, include the following configuration in your `appsettings.json` file:

* [Log API][Serilog - Config - LogAPI]

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><p>The <strong>Settings</strong> section is shared by all <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Serilog sinks. Read more at <a href="https://docs.nodinite.com/logging-and-monitoring/serilog/settings-section/">Settings Section (appsettings.json)</a></p></div>
</aside>

## Log Event address (NodiniteApiUrl)

<sup><span class="nodinite-new-badge">New 7.10.9</span></sup>

The Log API sink posts each [Log Event][] to the address in the `NodiniteApiUrl` setting exactly as you configure it (a trailing `/` is ignored). Set it to the Log Event address of your environment's Log API, in the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> v7 format `https://{host}:{port}/LogAPI/api/LogEvent`. The host and port come from your environment's settings in the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Portal ([Servers step][]).

### Breaking change in 7.10.9

Versions before 7.10.9 appended `LogEvent/LogEvent` to the configured `NodiniteApiUrl`. The <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> v7 Log API doesn't serve that route, so earlier versions of the sink don't work; the Log API answers with HTTP 404.

When you update `Nodinite.Serilog.ApiSink` to version 7.10.9 or later:

1. Find every place you set `NodiniteApiUrl`: in code, and in the `Args` of your `appsettings.json`.
2. Change the value to the complete Log Event address (see above).
3. If your current value ends in `/LogAPI/api/`, add `LogEvent` to the end of it.

|Current value|7.10.9 and later|
|---|---|
|`https://fancysrv01:50002/LogAPI/api/`|`https://fancysrv01:50002/LogAPI/api/LogEvent`|

### Configure NodiniteApiUrl in appsettings.json

```json
{
  "Serilog": {
    "Using": [ "Nodinite.Serilog.ApiSink" ],
    "WriteTo": [
      {
        "Name": "NodiniteApiSink",
        "Args": {
          "NodiniteApiUrl": "https://fancysrv01:50002/LogAPI/api/LogEvent",
          "Settings": {
            ...
          }
        }
      }
    ]
  }
}
```

### Configure NodiniteApiUrl in code

```csharp
var nodiniteSettings = new NodiniteLogEventSettings
{
    LogAgentValueId = 503,
    EndPointName = "Timers",
    EndPointUri = "https://timers.contoso.com/",
    EndPointDirection = 0,
    EndPointTypeId = 0,
    OriginalMessageTypeName = "Timers.LogEvent/1.0",
    ProcessingUser = "TIMERS",
    ProcessName = "Timers",
    ProcessingMachineName = "BROWSER",
    ProcessingModuleName = "Timers",
    ProcessingModuleType = "BlazorWebAssembly"
};

var logger = new LoggerConfiguration()
    .WriteTo.NodiniteApiSink("https://fancysrv01:50002/LogAPI/api/LogEvent", nodiniteSettings)
    .CreateLogger();

builder.Services.AddSingleton<Serilog.ILogger>(logger);
```

Replace the host and port with the values of your environment's Log API.

### Rejected Log Events

<sup><span class="nodinite-new-badge">New 7.10.9</span></sup>

When the Log API refuses a Log Event, for example because of a wrong `NodiniteApiUrl`, the sink reports the HTTP status and the Log API's response:

* With `WriteTo`, [Serilog][] writes the error to its [SelfLog](https://github.com/serilog/serilog/wiki/Debugging-and-Diagnostics)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>. Enable it during troubleshooting, for example with `Serilog.Debugging.SelfLog.Enable(Console.Error);`.
* With `AuditTo`, your code receives the error.

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><p>The application opens every connection outbound. For the ports and hostnames to allow, see the <a href="https://docs.nodinite.com/logging-and-monitoring/serilog/overview/#fa-shield-check-what-firewall-settings-are-required-for-the-nodinite-serilog-sinks">firewall settings for the Nodinite Serilog sinks</a>.</p></div>
</aside>

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

❔['How To Start Logging With Microsoft.Extensions.Logging.ILogger in Azure Functions'][Serilog - ILogger]  
❔['How To Start Logging With Serilog'][Serilog - Logger]  
  
## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

<i class="fal fa-file" aria-hidden="true"></i> [Message Types][] - Critical for [Search Field][Search Fields] extraction from Log API sink events  
<i class="fal fa-magnifying-glass-plus" aria-hidden="true"></i> [Search Field Expressions][] - Extract business data from logged messages  
<i class="fal fa-table-list" aria-hidden="true"></i> [Log Views][] - Search logged data by business identifiers  
<i class="fal fa-stopwatch" aria-hidden="true"></i> [Non-Events Monitoring][] - Track message volumes and detect missing messages  
<i class="fal fa-project-diagram" aria-hidden="true"></i> [Business Process Modeling (BPM)][BPM] - End-to-end transaction tracking  
<i class="fal fa-coins" aria-hidden="true"></i> [Reduce Azure Functions Logging Costs][] - Lower the Azure cost of logging Azure Functions  
<i class="fal fa-coins" aria-hidden="true"></i> [Azure Costs for Blob Storage and Event Hub][] - What staging log events in Azure costs  
<i class="fal fa-clock" aria-hidden="true"></i> [Reduce Azure Logic Apps Run History Retention to Lower TCO][] - The same approach for Logic Apps  
<i class="fal fa-cloud-arrow-down" aria-hidden="true"></i> [Reduce Azure API Management Logging Costs][] - The same approach for API Management  

* [Serilog - Blob Storage][]  
* [Serilog - Event Hub][]  
* [Serilog - File][]  
* [Serilog - Service Bus][]  

[Azure Costs for Blob Storage and Event Hub]:https://docs.nodinite.com/logging-and-monitoring/custom-logging/troubleshooting/azure-costs-for-blob-storage-and-event-hub/
[BPM]:https://docs.nodinite.com/repository-model/bpms/overview/
[Log API]:https://docs.nodinite.com/core-services/log-api/overview/
[Log Event]:https://docs.nodinite.com/core-services/log-event/overview/
[Log Views]:https://docs.nodinite.com/administration/log-management/log-views/features/what-is-a-log-view/
[Message Types]:https://docs.nodinite.com/repository-model/message-types/overview/
[Microsoft Azure functions]:https://azure.microsoft.com/en-us/products/functions/
[Non-Events Monitoring]:https://docs.nodinite.com/logging-and-monitoring/non-events/overview/
[Reduce Azure API Management Logging Costs]:https://docs.nodinite.com/logging-and-monitoring/azure-api-management/troubleshooting/reduce-azure-api-management-logging-costs/
[Reduce Azure Functions Logging Costs]:https://docs.nodinite.com/logging-and-monitoring/serilog/troubleshooting/reduce-azure-functions-logging-costs/
[Reduce Azure Logic Apps Run History Retention to Lower TCO]:https://docs.nodinite.com/logging-and-monitoring/azure-logic-apps/troubleshooting/reduce-azure-logic-apps-run-history-retention-to-lower-tco/
[Search Field Expressions]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/overview/
[Search Fields]:https://docs.nodinite.com/administration/log-management/search-fields/features/what-is-a-search-field/
[Serilog]:https://docs.nodinite.com/logging-and-monitoring/serilog/overview/
[Serilog - Blob Storage]:https://docs.nodinite.com/logging-and-monitoring/serilog/features/blob-storage/
[Serilog - Config - LogAPI]:https://docs.nodinite.com/logging-and-monitoring/serilog/how-to-start-logging-with-serilog/#log-api
[Serilog - Event Hub]:https://docs.nodinite.com/logging-and-monitoring/serilog/features/event-hub/
[Serilog - File]:https://docs.nodinite.com/logging-and-monitoring/serilog/features/file/
[Serilog - ILogger]:https://docs.nodinite.com/logging-and-monitoring/serilog/how-to-start-logging-extending-ilogger/
[Serilog - Logger]:https://docs.nodinite.com/logging-and-monitoring/serilog/how-to-start-logging-with-serilog/
[Serilog - Service Bus]:https://docs.nodinite.com/logging-and-monitoring/serilog/features/servicebus/
[Serilog - Settings Section]:https://docs.nodinite.com/logging-and-monitoring/serilog/settings-section/
[Serilog firewall]:https://docs.nodinite.com/logging-and-monitoring/serilog/overview/#fa-shield-check-what-firewall-settings-are-required-for-the-nodinite-serilog-sinks
[Servers step]:https://docs.nodinite.com/install-and-update/getting-started/version-7/install-nodinite-v7-steps/04-servers/#core-platform-services