---
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.
---

:ReleaseNotes(https://portal.nodinite.com/marketplace/15):

# :fa-display: Nodinite Serilog sink using Nodinite Log API

Use the :Nodinite: Serilog sink for the :Nodinite: [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). :Nodinite: supports payload Logging and removes the obstacle that Application Insights logging imposes on message size.

>[!IMPORTANT]
>**Set OriginalMessageType for searchable business data** - The Log API sink sends your log events synchronously to the Nodinite Log API for immediate processing. Without proper [Message Types][], your logged events won't have business data extraction via [Search Field Expressions][], preventing features like [Non-Events Monitoring][], [Business Process Modeling (BPM)][BPM], and business-data searches in [Log Views][] from functioning. Always include `OriginalMessageType` in your logging code before deploying to production. **Log API sink provides synchronous logging with immediate confirmation but requires direct network connectivity to Nodinite.**

>[!WARNING]
>**BREAKING CHANGE in version 7.10.9** - When you update the `Nodinite.Serilog.ApiSink` package to version 7.10.9 or later, you must change the `NodiniteApiUrl` setting to the complete [Log Event][] address of your [Log API][], ending in `/api/LogEvent`. The sink no longer adds anything to the address you configure. Read more in [Log Event address (NodiniteApiUrl)](#log-event-address-nodiniteapiurl).

<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]

>[!TIP]
>The **Settings** section is shared by all :Nodinite: Serilog sinks. Read more at [Settings Section (appsettings.json)][Serilog - Settings Section]

## Log Event address (NodiniteApiUrl)

:new7.10.9:

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 :Nodinite: v7 format `https://{host}:{port}/LogAPI/api/LogEvent`. The host and port come from your environment's settings in the :Nodinite: Portal ([Servers step][]).

### Breaking change in 7.10.9

Versions before 7.10.9 appended `LogEvent/LogEvent` to the configured `NodiniteApiUrl`. The :Nodinite: 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

:new7.10.9:

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>:fa-arrow-up-right-from-square:</sup>. Enable it during troubleshooting, for example with `Serilog.Debugging.SelfLog.Enable(Console.Error);`.
* With `AuditTo`, your code receives the error.

>[!TIP]
>The application opens every connection outbound. For the ports and hostnames to allow, see the [firewall settings for the Nodinite Serilog sinks][Serilog firewall].

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

❔['How To Start Logging With Microsoft.Extensions.Logging.ILogger in Azure Functions'][Serilog - ILogger]  
❔['How To Start Logging With Serilog'][Serilog - Logger]  
  
## :fa-link-horizontal: Related Topics

:fa-file: [Message Types][] - Critical for [Search Field][Search Fields] extraction from Log API sink events  
:fa-magnifying-glass-plus: [Search Field Expressions][] - Extract business data from logged messages  
:fa-table-list: [Log Views][] - Search logged data by business identifiers  
:fa-stopwatch: [Non-Events Monitoring][] - Track message volumes and detect missing messages  
:fa-project-diagram: [Business Process Modeling (BPM)][BPM] - End-to-end transaction tracking  
:fa-coins: [Reduce Azure Functions Logging Costs][] - Lower the Azure cost of logging Azure Functions  
:fa-coins: [Azure Costs for Blob Storage and Event Hub][] - What staging log events in Azure costs  
:fa-clock: [Reduce Azure Logic Apps Run History Retention to Lower TCO][] - The same approach for Logic Apps  
:fa-cloud-arrow-down: [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]:{ndr}/Logging%20and%20Monitoring/Custom%20Logging/Troubleshooting/Azure%20Costs%20for%20Blob%20Storage%20and%20Event%20Hub.md
[BPM]:{ndr}/Repository%20Model/BPMs/Overview.md
[Log API]:{ndr}/Core%20Services/Log%20API/Overview.md
[Log Event]:{ndr}/Core%20Services/Log%20Event/Overview.md
[Log Views]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/What%20is%20a%20Log%20View.md
[Message Types]:{ndr}/Repository%20Model/Message%20Types/Overview.md
[Microsoft Azure functions]:https://azure.microsoft.com/en-us/products/functions/
[Non-Events Monitoring]:{ndr}/Logging%20and%20Monitoring/Non-Events/Overview.md
[Reduce Azure API Management Logging Costs]:{ndr}/Logging%20and%20Monitoring/Azure%20API%20Management/Troubleshooting/Reduce%20Azure%20API%20Management%20Logging%20Costs.md
[Reduce Azure Functions Logging Costs]:{ndr}/Logging%20and%20Monitoring/Serilog/Troubleshooting/Reduce%20Azure%20Functions%20Logging%20Costs.md
[Reduce Azure Logic Apps Run History Retention to Lower TCO]:{ndr}/Logging%20and%20Monitoring/Azure%20Logic%20Apps/Troubleshooting/Reduce%20Azure%20Logic%20Apps%20Run%20History%20Retention%20to%20Lower%20TCO.md
[Search Field Expressions]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md
[Search Fields]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/What%20is%20a%20Search%20Field.md
[Serilog]:{ndr}/Logging%20and%20Monitoring/Serilog/Overview.md
[Serilog - Blob Storage]:{ndr}/Logging%20and%20Monitoring/Serilog/Features/Blob%20Storage.md
[Serilog - Config - LogAPI]:{ndr}/Logging%20and%20Monitoring/Serilog/How%20To%20Start%20Logging%20With%20Serilog.md#log-api
[Serilog - Event Hub]:{ndr}/Logging%20and%20Monitoring/Serilog/Features/Event%20Hub.md
[Serilog - File]:{ndr}/Logging%20and%20Monitoring/Serilog/Features/File.md
[Serilog - ILogger]:{ndr}/Logging%20and%20Monitoring/Serilog/How%20To%20Start%20Logging%20Extending%20ILogger.md
[Serilog - Logger]:{ndr}/Logging%20and%20Monitoring/Serilog/How%20To%20Start%20Logging%20With%20Serilog.md
[Serilog - Service Bus]:{ndr}/Logging%20and%20Monitoring/Serilog/Features/ServiceBus.md
[Serilog - Settings Section]:{ndr}/Logging%20and%20Monitoring/Serilog/Settings%20Section.md
[Serilog firewall]:{ndr}/Logging%20and%20Monitoring/Serilog/Overview.md#fa-shield-check-what-firewall-settings-are-required-for-the-nodinite-serilog-sinks
[Servers step]:{ndr}/Install%20and%20Update/Getting%20started/Version%207/Install%20Nodinite%20v7%20Steps/04%20-%20Servers.md#core-platform-services