---
title: Log the Payload and Context, and Re-index When You Learn More
description: "Why to log the message body and the context with every Nodinite Log Event: you don't know what you'll need to search on until something breaks, and Nodinite can re-index messages already logged to extract new Search Fields per Message Type, render them with Stylesheets, and resend them."
---

# :fa-file-code: Log the Payload and Context

You don't know the truth until something goes wrong, and by then it's too late to start logging. The question that matters on the bad day ("which orders had this product?", "what did we actually send?") is rarely the one you planned for. When every [Log Event][] carries the message body and its context, :Nodinite: can answer questions nobody asked at go-live.

* ✅ Keep the evidence: the exact message that was sent or received  
* ✅ Add a new [Search Field][Search Fields] months later and find it in messages already logged  
* ✅ Let support read, render, and resend messages without access to the platform  

## :fa-network-wired: Understanding Re-indexing {#understanding}

<div class="mermaid">
flowchart LR
    Logged["fa:fa-database Events logged<br/>with body and context"] --> New["fa:fa-plus New Search Field<br/>Purchase Order Number"]
    New --> Reindex["fa:fa-rotate Re-index<br/>per Message Type"]
    Reindex --> Found["fa:fa-magnifying-glass Every historical<br/>order searchable"]
    style Logged fill:#3F827B
    style New fill:#2678BD
    style Reindex fill:#E47528
    style Found fill:#93d16d
</div>

*Events logged with body and context (teal) can be processed again: a new [Search Field][Search Fields] (blue) and a re-index of its [Message Types][] (orange) make the new value searchable in every message still kept (green). Without a body, there is nothing to re-index.*

![Action menu of a Contoso Message Type with Reindex highlighted (7.13)][1]  
*Re-indexing is chosen per [Message Type][Message Types], so only the formats that changed are processed again. How it runs, and how to plan a large one, is in [Add or manage Search Field][Add or manage Search Field - Re-index].*  

## :fa-code-compare: What Each Part Gives You {#parts}

| You log | Users can | Without it |
| --- | --- | --- |
| Event details only | See that something happened, when, and with what status | ❌ No business search, no evidence |
| + Context | Search on the values you put there, such as an order number or a file name | ⚠️ Only the questions you thought of at go-live |
| + Body | Search on anything in the message, now or after a re-index; read it as a document with a [Stylesheet][Stylesheets]; [resend it][Resend and Download Log Events] | ✅ Nothing missing |

Context values are cheap to extract and great for the keys you know. The body is the truth. Log both.

## :fa-list-check: Rules for Payload and Context {#rules}

* ✅ Log the body at every hop where the message changes: received, transformed, sent  
* ✅ Put the business keys in the context as well, such as the Order Id; see [Correlate Transactions End to End][]  
* ✅ Set a versioned [Message Type][Message Types] on every event (`Orders.Received/1.0`): Search Fields, re-index, retention, and statistics all work per Message Type  
* ✅ Use the encoding the message really has, or set it on the Message Type; see [Character Encoding][]  
* ⚠️ Very large bodies: the [Logging Service][] does not process a body above [MessageProcessingMaxBodySize][] (250 MB by default); such events get the [Processing State][] **Failed**  
* ⚠️ Sensitive data: limit who can see them with [Log Views][] per [Role][Roles], keep them briefly with [retention per Message Type][Plan Volume and Retention], and know that opening a body is recorded in [Log Audit Search][]  

## :fa-question: Frequently Asked Questions {#faq}

### Isn't logging every body expensive?

Storage is cheaper than an unsolved incident. Keep high-volume formats for a short time and audit-relevant ones for years: :Nodinite: sets retention per [Message Type][Message Types]. See [Plan Volume and Retention][].

### How do I extract an Order Number from a message I have already logged?

Open the message body, start the [Search Field Wizard][], add a [Search Field][Search Fields] with an expression for the order number, and click **Reindex** at the end. Then add the Search Field to your [Log View][Log Views]'s search criteria.

![Extract an order number from orders already logged and search on it, animated walkthrough (7.13)][2]  
*Animated walkthrough: a [Log View][Log Views] that searches on the customer only gets a new Search Field for the order number, and then finds orders logged before that Search Field existed.*  

1. In the Log View, search on the customer, such as `CUST-001` in **O2C - Customer ID**. The orders are logged with their body, but there is no order number to search on.
2. Open the **Action** menu of an order and open its body. The order number is in the body, as `orderId`.
3. Click **Search Field Wizard**. The event's [Message Type][Message Types], such as **O2C.Order.Received/1.0**, is picked for you. Choose **New Search Field** and name it, such as **Contoso: Order Number**.
4. Click **Next**, read the value from the body with [JSON Path][], and type the expression `$.orderId`. The wizard shows the value it finds, such as `ORD-10007`.
5. Click **Next** to the summary, then **Save**, and then **Reindex**. The reindex runs in the background over the events already logged for this Message Type.
6. Add the Search Field to the Log View's search criteria (**Default search setup**).
7. Search on the order number, such as `ORD-10007`. The Log View finds the orders logged before the Search Field existed.

See [How do I extract business data like Order Numbers?][Extract Business Data] and [Re-Indexing by Message Type][Message Types - Reindex].

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

* :fa-database: [Plan Volume and Retention][]  
* :fa-compass: [Plan Your Logging with Nodinite][Logging Strategy]  

## :fa-link-horizontal: Related Topics

* :fa-magnifying-glass: [Add or manage Search Field][]  
* :fa-file: [Message Types][]  
* :fa-sliders: [Context Options][]  
* :fa-paint-roller: [Stylesheets][]  
* :fa-arrow-rotate-left: [Resend and Download Log Events][]  
* :fa-flag: [Log Status and Errors][]  

[1]:{ndm}/Documentation%20Pictures/IM/WebClient/Repository/MessageTypes/ReindexActionMenuItem.png
[2]:{ndm}/Documentation%20Pictures/IM/WebClient/Log/LogEvent_ExtractAfterTheFact.gif

[Add or manage Search Field]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Add%20or%20manage%20Search%20Field.md
[Add or manage Search Field - Re-index]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Add%20or%20manage%20Search%20Field.md#save-and-re-index
[Character Encoding]:{ndr}/Core%20Services/Log%20Event/Features/Character%20Encoding.md
[Context Options]:{ndr}/Core%20Services/Log%20Event/Features/Context%20Options.md
[Correlate Transactions End to End]:{ndr}/Getting%20Started/2.%20Log/Logging%20Strategy/Correlate%20Transactions%20End%20to%20End.md
[Extract Business Data]:{ndr}/Logging%20and%20Monitoring/Custom%20Logging/Troubleshooting/Extract%20Business%20Data.md
[JSON Path]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/JSON%20Path.md
[Log Audit Search]:{ndr}/Administration/6.%20Tools/2.%20Log%20Audit%20Search.md
[Log Event]:{ndr}/Core%20Services/Log%20Event/Overview.md
[Log Status and Errors]:{ndr}/Getting%20Started/2.%20Log/Logging%20Strategy/Log%20Status%20and%20Errors.md
[Log Views]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/What%20is%20a%20Log%20View.md
[Logging Service]:{ndr}/Core%20Services/Logging%20Service/Overview.md
[Logging Strategy]:{ndr}/Getting%20Started/2.%20Log/Logging%20Strategy/Overview.md
[Message Types]:{ndr}/Repository%20Model/Message%20Types/Overview.md
[Message Types - Reindex]:{ndr}/Repository%20Model/Message%20Types/Overview.md#re-indexing-by-message-type
[MessageProcessingMaxBodySize]:{ndr}/Administration/5.%20Settings/5.%20System%20Parameters/MessageProcessingMaxBodySize.md
[Plan Volume and Retention]:{ndr}/Getting%20Started/2.%20Log/Logging%20Strategy/Plan%20Volume%20and%20Retention.md
[Processing State]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/Log%20View%20Search%20Fields%20and%20Processing%20State.md#processing-state
[Resend and Download Log Events]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/Resend%20and%20Download%20Log%20Events.md
[Roles]:{ndr}/Administration/3.%20Access%20Management/1.%20Roles/Features/What%20is%20a%20Role.md
[Search Field Wizard]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Getting%20started/How%20to%20use%20the%20Search%20Field%20Wizard.md
[Search Fields]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/What%20is%20a%20Search%20Field.md
[Stylesheets]:{ndr}/Administration/4.%20Customize/2.%20Stylesheets/Features/What%20is%20a%20Stylesheet.md