---
title: Extract Business Data from Logged Messages
description: How to extract business data like Order Numbers, Customer IDs, and Invoice amounts from logged messages using Search Field Expressions.
---

# How do I extract business data like Order Numbers from logged messages?

**Use [Search Field Expressions][] to automatically extract Order Numbers, Customer IDs, Invoice amounts, and other business identifiers from your logged message bodies**—no manual parsing, no SQL queries.

## How It Works

1. **Define [Message Types][]** - Identify message formats: "PurchaseOrder#1.0", "Invoice#2.0", "CustomerUpdate#1.0"
2. **Include message body in [JSON Log Event][]** - Set `Body` field with XML, JSON, CSV, EDIFACT, or X12 content
3. **Create Search Field Expressions** - Configure extraction rules bound to Message Types
4. **:Nodinite: extracts automatically** - When logs arrive, [Search Fields][] parse message bodies and extract business identifiers
5. **Business users search by business data** - [Log Views][] enable search: "Show me Order 12345" or "Export invoices >$10K for customer Contoso"

## Example: Extract Order Number from XML

**Message Type:** `PurchaseOrder#1.0`

**Logged message body (XML):**

```xml
<Order>
  <OrderId>PO-2025-001</OrderId>
  <CustomerId>CUST-12345</CustomerId>
  <OrderAmount>15750.50</OrderAmount>
  <OrderDate>2025-10-12</OrderDate>
</Order>
```

**Search Field Expression ([XPath][]):**

```xpath
/Order/OrderId/text()
```

**Result:** :Nodinite: automatically extracts `PO-2025-001` as searchable field. Business users search: "Order PO-2025-001" → finds transaction instantly.

## Example: Extract Customer ID from JSON

**Message Type:** `APIRequest#1.0`

**Logged message body (JSON):**

```json
{
  "requestId": "req-98765",
  "customerId": "CUST-Contoso",
  "endpoint": "/api/orders",
  "responseTime": 145
}
```

**Search Field Expression ([JSON Path][]):**

```jsonpath
$.customerId
```

**Result:** Extracts `CUST-Contoso`. Business users filter Log View: "Show all API requests for customer CUST-Contoso last week".

## Supported Extraction Methods

Search Field Expressions support multiple parsers:

* :fa-code: **XPath** - XML messages (`/Order/OrderId/text()`)
* :fa-brackets-curly: **JSON Path** - JSON messages (`$.order.orderId`, `$.items[0].sku`)
* :fa-filter: **Regular Expressions** - Any text format (`Order ID: (\d+)`)
* :fa-file-lines: **Flat File parsers** - CSV, fixed-width, delimited formats
* :fa-function: [Formula][] - Complex transformations, concatenation, conditional logic

## Multiple Search Fields Per Message Type

Extract multiple business identifiers from same message:

**Message Type:** `PurchaseOrder#1.0`

* **Search Field 1:** `OrderId` (XPath: `/Order/OrderId/text()`)
* **Search Field 2:** `CustomerId` (XPath: `/Order/CustomerId/text()`)
* **Search Field 3:** `OrderAmount` (XPath: `/Order/OrderAmount/text()`)

**Result:** Business users search by any combination: "Orders from customer CUST-12345 with amount >$10K last month".

## Configuration Steps

1. **Navigate to Administration → Log Management → Search Fields**
2. **Create Search Field** - Name: "Order Number", Description: "PurchaseOrder identifier"
3. **Bind to Message Type** - Select "PurchaseOrder#1.0"
4. **Configure Expression** - Choose parser (XPath, JSON Path, Regex), enter extraction rule
5. **Test with sample** - Validate extraction with sample message body
6. **Save** - :Nodinite: applies to all future logs with that Message Type

**Existing logs:** Search Fields apply retroactively—re-index existing logs to extract business data from historical messages.

---

**Related Topics:**  
[Search Field Expressions Overview][]  
[Message Types][]  
[Formula for Complex Transformations][]  

**See all FAQs:** [Troubleshooting Overview][]

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

:fa-book: [Back to Custom Logging Overview][Custom Logging Overview]  

## :fa-link-horizontal: Related Topics

* :fa-question-circle: [Troubleshooting Overview][Troubleshooting]  

[Custom Logging Overview]:{ndr}/Logging%20and%20Monitoring/Custom%20Logging/Overview.md
[Formula]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Formula/Overview.md
[Formula for Complex Transformations]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Formula/Overview.md
[JSON Log Event]:{ndr}/Core%20Services/Log%20Event/Features/JSON%20Log%20Event.md
[JSON Path]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/JSON%20Path.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
[Search Field Expressions]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md
[Search Field Expressions Overview]:{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
[Troubleshooting]:{ndr}/Logging%20and%20Monitoring/Custom%20Logging/Troubleshooting/Overview.md
[Troubleshooting Overview]:{ndr}/Logging%20and%20Monitoring/Custom%20Logging/Troubleshooting/Overview.md
[XPath]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Formula/Extract/xPath.md