---
title: Remove Old Message Types and Endpoints in Nodinite 7 – Find Unused Items and Permanently Delete
description: "Remove unused Message Types and Endpoints from Nodinite 7 the supported way: find them by Last Event, delete, then Permanently Delete with an impact preview and a Log Audit entry. Read-only SQL finds candidates; direct DELETE scripts are not supported."
---

# Manually Removing Old Configuration Data

Keep your :Nodinite: environment lean by removing [Message Types][] and [Endpoints][] that no longer receive [Log Events][Log Event]. In :Nodinite: 7 you do this in the [Web Client][]: find the unused items, delete them, then permanently delete them. Every permanent delete shows what goes with the item first and leaves a [Log Audit][Log Audit Search] entry.

* ✅ Find unused Message Types and Endpoints by their **Last Event**, without SQL  
* ✅ Remove many at once with **With Selected**, after an impact preview  
* ✅ Every removal is restorable until you permanently delete it, and audited when you do  
* ✅ Read-only SQL queries find candidates when the lists are very long  

>[!IMPORTANT]
>Don't run DELETE statements against the [Configuration Database][]. A direct DELETE skips the soft delete, the impact preview and the Log Audit entry. In 7.x it also fails halfway (C4 Flows hold a foreign key to Message Types), removes Endpoints the product would keep, and leaves [Tag][Tags], [Article][Articles] and C4 node links pointing at ids that get reused. :Nodinite: never removes configuration data on its own: removing it is always an Administrator's decision in the Web Client.

## :fa-diagram-project: Understanding the Cleanup

:Nodinite: tracks every combination of Message Type and Endpoint it has logged in the `LogPoints` table of the [Configuration Database][], with `FirstSeen` and `LastSeen`. The [Logging Service][] keeps them current. An item whose newest `LastSeen` is older than the retention of its events has no Log Events left in the [Log Databases][]: it is no longer in use.

<div class="mermaid">
flowchart LR
    F["fa:fa-magnifying-glass Find<br/>sort by Last Event"] --> D["fa:fa-trash-can Delete<br/>restorable"]
    D --> P["fa:fa-trash-xmark Permanently Delete<br/>impact preview"]
    P --> A["fa:fa-clipboard-list Log Audit<br/>one entry"]
    style F fill:#2678BD,color:#fff
    style D fill:#FFD525,color:#000
    style P fill:#c33d34,color:#fff
    style A fill:#3F827B,color:#fff
</div>

*Blue: you find the candidates in the Message Types or Endpoints list. Yellow: Delete is a soft delete you can undo with Restore. Red: Permanently Delete removes the item and everything that refers to it. Teal: [Log Audit Search][] records who removed what. See [Two delete models][Delete models].*

| Item | Its retention | Who may remove it |
|---|---|---|
| [Message Type][Message Types] | Its own **Days to keep events** (also messages and context) | Administrators ([Permanently Delete][Message Types - Permanently Delete]) |
| [Endpoint][Endpoints] | None of its own: its Log Events follow their Message Types' retention | Administrators ([Permanently Delete][Endpoints - Permanently Delete]) |
| [Log Agent][Log Agents - Permanently Delete] | Not applicable | Administrators, one at a time; removes every Endpoint of the agent |

## :fa-magnifying-glass: Step 1: Find Unused Message Types and Endpoints

1. In **Administration** > **Repository**, open **Message Types** (or **Endpoints**).
2. Sort the list by **Last Event**, oldest first. **Last Event** is the last time an event with this Message Type (or on this Endpoint) was seen. **N/A** means the item was never logged.
3. The items at the top are your candidates. Compare a Message Type's **Last Event** with its **Days to keep events**. For Endpoints, choose your own threshold, such as the longest retention of the Message Types logged on them.

The [Web API][] returns the same value as `EventLastSeen` for Administrators.

### Find candidates with SQL (read-only)

With thousands of items, a query can list the candidates for you. These queries only read; run them in SQL Server Management Studio against the [Configuration Database][], then remove the items in the Web Client (Step 2).

```sql
-- Message Types whose every Log Point is older than the Message Type's retention.
-- Id 0 is the default Unknown Message Type and is never removed.
;WITH Old AS (
    SELECT LP.MessageTypeId, MAX(LP.LastSeen) AS LastSeen
    FROM LogPoints LP
    JOIN MessageTypes MT ON LP.MessageTypeId = MT.MessageTypeId AND MT.MessageTypeId > 0
    GROUP BY LP.MessageTypeId, MT.DaysToKeepEvents
    HAVING MAX(LP.LastSeen) < DATEADD(DD, MT.DaysToKeepEvents * -1, GETDATE())
)
SELECT MT.MessageTypeId, MT.Name, Old.LastSeen
FROM Old
JOIN MessageTypes MT ON MT.MessageTypeId = Old.MessageTypeId
ORDER BY Old.LastSeen
```

*Each Message Type listed has no Log Point newer than its own retention.*  

```sql
-- Endpoints with no Log Point newer than your threshold (92 days here; Endpoints have no retention of their own).
-- Id 0 is the default Endpoint and is never removed.
DECLARE @days INT = 92;
SELECT EP.EndPointId, EP.Name, MAX(LP.LastSeen) AS LastSeen
FROM [EndPoints] EP
LEFT JOIN LogPoints LP ON LP.EndPointId = EP.EndPointId
WHERE EP.EndPointId > 0
GROUP BY EP.EndPointId, EP.Name
HAVING MAX(LP.LastSeen) IS NULL OR MAX(LP.LastSeen) < DATEADD(DD, @days * -1, GETDATE())
ORDER BY LastSeen
```

*A `NULL` LastSeen means the Endpoint was never logged.*  

## :fa-trash-can: Step 2: Delete, Then Permanently Delete

1. In the list, tick the candidates, and choose **With Selected** > **Delete**. They are soft deleted and can still be restored.
2. Tick **Include deleted**, tick the same items again, and choose **With Selected** > **Permanently Delete**.
3. Read the impact dialog. It counts what goes with the items (Log Points and their metrics, [Custom Metadata][] values, Tag and Article links, Log and [Monitor View][Monitor Views] filters, [Transport Contract][Transport Contracts] links) and lists the Log and Monitor Views that change.
4. Tick that you understand it can't be undone, and confirm.

A Message Type that a C4 Flow carries loses only that binding: the Flow stays. An Endpoint's default Message Type is cleared, not the Endpoint. A Transport Contract left without a Message Type or an Endpoint is removed with its [Contract][Contracts]. The full lists are in [What is removed, and what is kept][Message Types - What is removed] for Message Types and [the same section][Endpoints - What is removed] for Endpoints.

>[!NOTE]
>An Endpoint that still receives Log Events is created again by the [Logging Service][]. Remove the Endpoint once its sender is retired. To retire a whole [Log Agent][Log Agents - Permanently Delete], permanently delete the Log Agent: it removes every Endpoint it created.

## :fa-clipboard-list: Step 3: Check the Log Audit

In **Administration** > **Tools** > [Log Audit Search][], pick the Function `cnfg_MessageTypes_HardDelete` or `cnfg_EndPoints_HardDelete`, and click **Search**. Each permanent delete is one entry that names what was removed and who removed it.

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

* :fa-file: [Message Types - Permanently Delete][]  
* :fa-sign-out: [Endpoints - Permanently Delete][]  
* :fa-database: [Remove duplicate Endpoints][]  

## :fa-link-horizontal: Related Topics

* :fa-trash-can: [Two delete models][Delete models]  
* :fa-user-tag: [Log Audit Search][]  
* :fa-database: [Configuration Database][]  
* :fa-database: [Log Databases][]  
* :fa-database: [SQL Server Troubleshooting][SQL Server Overview]  
* :fa-trash: [Automating removal of old Log Databases][AutoRemove]  

[Articles]:{ndr}/Repository%20Model/Knowledge%20base%20Articles/Overview.md
[AutoRemove]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Automating%20removal%20of%20old%20Log%20Databases.md
[Configuration Database]:{ndr}/Core%20Services/Configuration%20Database/Overview.md
[Contracts]:{ndr}/Getting%20Started/4.%20Repository/Contracts/Overview.md
[Custom Metadata]:{ndr}/Repository%20Model/Custom%20Metadata/Overview.md
[Delete models]:{ndr}/Administration/7.%20Repository/Overview.md#fa-trash-can-two-delete-models
[Endpoints]:{ndr}/Repository%20Model/Endpoints/Overview.md
[Endpoints - Permanently Delete]:{ndr}/Administration/7.%20Repository/Endpoints/Overview.md#fa-trash-xmark-permanently-delete-endpoints
[Endpoints - What is removed]:{ndr}/Administration/7.%20Repository/Endpoints/Overview.md#what-is-removed-and-what-is-kept
[Log Agents - Permanently Delete]:{ndr}/Administration/1.%20Log%20Management/3.%20Log%20Agents/Overview.md#permanently-delete-log-agent
[Log Audit Search]:{ndr}/Administration/6.%20Tools/2.%20Log%20Audit%20Search.md
[Log Databases]:{ndr}/Core%20Services/Log%20Databases/Overview.md
[Log Event]:{ndr}/Core%20Services/Log%20Event/Overview.md
[Logging Service]:{ndr}/Core%20Services/Logging%20Service/Overview.md
[Message Types]:{ndr}/Repository%20Model/Message%20Types/Overview.md
[Message Types - Permanently Delete]:{ndr}/Administration/7.%20Repository/Message%20Types/Overview.md#fa-trash-xmark-permanently-delete-message-types
[Message Types - What is removed]:{ndr}/Administration/7.%20Repository/Message%20Types/Overview.md#what-is-removed-and-what-is-kept
[Monitor Views]:{ndr}/Administration/2.%20Monitor%20Management/1.%20Monitor%20Views/Features/What%20is%20a%20Monitor%20View.md
[Remove duplicate Endpoints]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Remove%20duplicate%20Endpoints.md
[SQL Server Overview]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Overview.md
[Tags]:{ndr}/Administration/4.%20Customize/5.%20Tags/Features/What%20is%20a%20Tag.md
[Transport Contracts]:{ndr}/Repository%20Model/Services/Overview.md#fa-microchip-transport-contracts-the-heart-of-service-definitions
[Web API]:{ndr}/Core%20Services/Web%20API/Overview.md
[Web Client]:{ndr}/Getting%20Started/Overview.md