---
title: "Azure Functions + Nodinite: Reduce Logging Costs and TCO"
description: "Lower the Azure cost of logging Azure Functions: keep Application Insights for performance telemetry, log business payloads once to Nodinite with Serilog, and give the business role-based access to the same data."
---

# <i class="fal fa-bolt" aria-hidden="true"></i> Azure Functions + Nodinite: Reduce Logging Costs and TCO

Azure Functions send their logs to **Application Insights** by default, and many teams log message payloads there as well. Application Insights stores that data in a Log Analytics workspace, billed per GB ingested and per GB retained. When you also log the same payloads to <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> with the [Serilog][] sinks, you pay for them twice.

In short: <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> can lower your Azure costs when it replaces payload logging and long retention in Application Insights. Your actual savings depend on your log volume, payload sizes, retention, Azure pricing, and on the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> license and SQL Server costs. This page covers only what's specific to Azure Functions; the shared cost model is on [Azure Costs for Blob Storage and Event Hub][].

## <i class="fal fa-sitemap" aria-hidden="true"></i> Understanding the two logging paths

<div class="mermaid">
graph LR
    FN["fa:fa-bolt Azure Function"] -->|Performance telemetry| AI["fa:fa-chart-line Application Insights<br/>for developers"]
    FN -->|Business payloads via Serilog| NOD["fa:fa-database Nodinite<br/>for developers and the business"]
    style FN fill:#2678BD
    style AI fill:#E47528
    style NOD fill:#93d16d
</div>

*Diagram: Keep Application Insights (orange) for performance telemetry, and log business payloads once to <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> (green).*

|Destination|Best at|Limits that matter for payloads|
|---|---|---|
|<i class="fal fa-chart-line" aria-hidden="true"></i> **Application Insights**|Requests, dependencies, exceptions, performance, and live debugging for developers|Trace messages are limited to 32,768 characters and telemetry items to 64 KB; Azure Functions [sample telemetry by default](https://learn.microsoft.com/en-us/azure/azure-functions/configure-monitoring#configure-sampling)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>, so it isn't a record of every message|
|<i class="fal fa-search" aria-hidden="true"></i> **<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span>**|Every business message with its full payload, searchable by business data, with retention per [Message Types][]|Staging cost in Blob Storage or Event Hub; see [Azure Costs for Blob Storage and Event Hub][]|

## <i class="fal fa-arrow-trend-down" aria-hidden="true"></i> Where the duplicate cost is

In Functions, payloads usually end up in Application Insights in one of these ways:

* `logger.LogInformation(...)` calls that write the message body, which land in the `traces` table
* a default log level of `Information` for all categories in `host.json`, so every user log is sent
* longer retention on the workspace, to keep message history for audits

What these payloads cost per GB in Log Analytics, with and without long retention, is shown in the [yearly cost table for API Management][APIM Yearly Cost]: the per-GB prices are the same for Functions.

## <i class="fal fa-sliders" aria-hidden="true"></i> Keep Application Insights lean

When <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> logs the business payloads, keep Application Insights for what it does best and stop sending payloads there:

1. Log message bodies only through the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> [Serilog][] sink, not through the logger that feeds Application Insights. See [How To Start Logging With Serilog][Serilog - Logger] and [ILogger in Azure Functions][Serilog - ILogger].
2. In `host.json`, set the default log level to `Warning` and keep `Host.Results` at `Information`, so you still get every function run in the `requests` table.
3. Keep sampling enabled, and exclude `Request` and `Exception` from sampling so failures are never dropped.
4. Keep the workspace retention at the included period; <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> keeps the long-term history.

```json
{
  "version": "2.0",
  "logging": {
    "logLevel": {
      "default": "Warning",
      "Host.Results": "Information",
      "Host.Aggregator": "Information"
    },
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request;Exception"
      }
    }
  }
}
```

*Example: a lean Application Insights setup for Azure Functions. See [Configure monitoring for Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/configure-monitoring)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup> for every option.*

<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>During a migration, Serilog can write to both destinations at the same time; see the <a href="https://docs.nodinite.com/logging-and-monitoring/serilog/troubleshooting/overview/">Serilog FAQ</a>. Remove the payloads from Application Insights once <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> has them.</p></div>
</aside>

## <i class="fal fa-users" aria-hidden="true"></i> Give the business access, not only developers

Application Insights is a developer tool: access goes through Azure RBAC, and searching means writing KQL. With role-based access in <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span>, business users search the same Function messages by Order ID or Invoice Number in [Log Views][], limited by their [Roles][], and in the same view as your Logic Apps and API Management traffic. Read why this matters in [Built for developers and the business][Azure Costs - Developers and Business].

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

* <i class="fal fa-code" aria-hidden="true"></i> [How To Start Logging With Serilog][Serilog - Logger]  
* <i class="fal fa-code" aria-hidden="true"></i> [How To Start Logging With ILogger in Azure Functions][Serilog - ILogger]  
* <i class="fal fa-file" aria-hidden="true"></i> [Configure Message Types][Message Types]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-coins" aria-hidden="true"></i> [Understand the Cost of Logging][Cost of Logging]  
* <i class="fal fa-coins" aria-hidden="true"></i> [Azure Costs for Blob Storage and Event Hub][]  
* <i class="fal fa-cloud-arrow-down" aria-hidden="true"></i> [Reduce Azure API Management Logging Costs][] — the same approach for API Management  
* <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-display" aria-hidden="true"></i> [Serilog][]  
* <i class="fal fa-circle-question" aria-hidden="true"></i> [Serilog FAQ][]  
* <i class="fal fa-table-list" aria-hidden="true"></i> [Log Views][]  
* <i class="fal fa-user-shield" aria-hidden="true"></i> [Roles][]  

[APIM Yearly Cost]:https://docs.nodinite.com/logging-and-monitoring/azure-api-management/troubleshooting/reduce-azure-api-management-logging-costs/#yearly-azure-cost-by-option
[Azure Costs - Developers and Business]:https://docs.nodinite.com/logging-and-monitoring/custom-logging/troubleshooting/azure-costs-for-blob-storage-and-event-hub/#fa-users-built-for-developers-and-the-business
[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/
[Cost of Logging]:https://docs.nodinite.com/getting-started/log/logging-strategy/understand-the-cost-of-logging/
[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/
[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 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/
[Roles]:https://docs.nodinite.com/administration/access-management/roles/features/what-is-a-role/
[Serilog]:https://docs.nodinite.com/logging-and-monitoring/serilog/overview/
[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 FAQ]:https://docs.nodinite.com/logging-and-monitoring/serilog/troubleshooting/overview/